09.12.2012 Views

Advanced Queuing - Oracle

Advanced Queuing - Oracle

Advanced Queuing - Oracle

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

JMS Message Consumer Features<br />

AQ Exception Handling<br />

}<br />

tsubs[3] = jms_session.createDurableSubscriber(topic[3], "SHIPPED_ORDER");<br />

MessageListener mL = new CustomerListener(jms_session);<br />

/* set the session’s message listener */<br />

jms_session.setMessageListener(mL);<br />

}catch(JMSException ex)<br />

{ System.out.println("Exception: " + ex); }<br />

AQ provides four integrated mechanisms to support exception handling in<br />

applications: EXCEPTION_QUEUES, EXPIRATION, MAX_RETRIES and RETRY_<br />

DELAY.<br />

An exception_queue is a repository for all expired or unserviceable messages.<br />

Applications cannot directly enqueue into exception queues. However, an<br />

application that intends to handle these expired or unserviceable messages can<br />

receive/remove them from the exception queue.<br />

To retrieve messages from exception queues, the JMS client must use the<br />

point-to-point interface.The exception queue for messages intended for a topic must<br />

be created in a queue table with multiple consumers enabled. Like any other queue,<br />

the exception queue must be enabled for receiving messages using the start method<br />

in the AQ<strong>Oracle</strong>Queue class. You will get an exception if you try to enable it for<br />

enqueue.<br />

The exception queue is a provider (<strong>Oracle</strong>) specific message property called "JMS_<br />

<strong>Oracle</strong>ExcpQ" that can be set with the message before sending/publishing it. If an<br />

exception queue is not specified, the default exception queue is used. If the<br />

queue/topic is created in a queue table, say QTAB, the default exception queue will<br />

be called AQ$_QTAB_E. The default exception queue is automatically created when<br />

the queue table is created.<br />

Messages are moved to the exception queues by AQ under the following<br />

conditions:<br />

The message is not being dequeued within the specified timeToLive. For<br />

messages intended for more than one subscriber, the message will be moved to<br />

the exception queue if one or more of the intended recipients is not able to<br />

dequeue the message within the specified timeToLive. If the timeToLive<br />

was not specified for the message, (either in the publish or send call, or as the<br />

publisher or sender), it will never expire.<br />

12-80 <strong>Oracle</strong>9i Application Developer’s Guide - <strong>Advanced</strong> <strong>Queuing</strong>

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

Saved successfully!

Ooh no, something went wrong!