09.12.2012 Views

Advanced Queuing - Oracle

Advanced Queuing - Oracle

Advanced Queuing - Oracle

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

JMS Message Consumer Features<br />

The message was received successfully. However, because of an error while<br />

<br />

processing the message, the application aborts the transaction that performed<br />

the receive. The message is returned to the queue/topic and will be available<br />

for any applications that are waiting to receive messages. Since this was a failed<br />

attempt to receive the message, its retry count is updated.<br />

If the retry count of the message exceeds the maximum value specified for the<br />

queue/topic where it resides, it is moved to the exception queue. When a<br />

message has multiple subscribers, then the message is moved to the exception<br />

queue only when all the recipients of the message have exceeded the retry limit.<br />

A receive is considered rolled back or undone if the application aborts the entire<br />

transaction, or if it rolls back to a savepoint that was taken before the receive.<br />

The client program successfully received a message but terminated before<br />

<br />

committing the transaction.<br />

Example Scenarios<br />

The section retry with delay interval has an example with MAX_RETRIES. In the<br />

BooksOnLine application, the business rule for each shipping region is that an order<br />

will be placed in a back order queue if the order cannot be filled immediately. The<br />

back order application will try to fill the order once a day. If the order cannot be<br />

filled within 7 days, it is placed in an exception queue for special processing. We<br />

implement this using the Time-to-Live property of messages in conjunction with<br />

exception queues.<br />

1. Create the exception queue WS_back_order_exp_que<br />

public void create_excp_que(TopicSession jms_session)<br />

{<br />

AQQueueTable q_table;<br />

Queue excpq;<br />

try {<br />

/* create the exception queue in the queue table with multiple<br />

* consumer flag true<br />

*/<br />

q_table = ((AQjmsSession)jms_session).getQueueTable("WS", "WS_orders_<br />

mqtab");<br />

AQjmsDestinationProperty dest_prop = new AQjmsDestinationProperty();<br />

dest_prop.setQueueType(AQjmsDestinationProperty.EXCEPTION_QUEUE);<br />

excpq = ((AQjmsSession)jms_session).createQueue(q_table,<br />

"WS_back_orders_excp_que",<br />

Creating Applications Using JMS 12-81

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!