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 />

Modes for Receiving Messages<br />

}<br />

}<br />

else<br />

throw ex;<br />

}<br />

}catch (JMSException ex)<br />

{<br />

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

}<br />

}<br />

For Point-to-Point Mode<br />

Aside from the normal receive, which allows the dequeuing client to delete the<br />

message from the queue, JMS provides an interface that allows the JMS client to<br />

Browse its messages in the queue. A QueueBrowser can be created using the<br />

createBrowser method from QueueSession.<br />

If a message is browsed, it remains available for further processing. Note that after a<br />

message has been browsed there is no guarantee that the message will be available<br />

to the JMS session again as a receive call from a concurrent session might remove<br />

the message.<br />

To prevent a viewed message from being removed by a concurrent JMS client, you<br />

can view the message in the locked mode. To do this, you need to create a<br />

QueueBrowser with the locked mode using the AQ extension to the JMS<br />

interface.The lock on the message with a browser with locked mode is released<br />

when the session performs a commit or a rollback.<br />

To remove the message viewed by a QueueBrowser, the session must create a<br />

QueueReceiver and use the JMSmesssageID as the selector.<br />

Example Code<br />

Refer to the QueueBrowser Example in Point-to-Point features<br />

Remove-No-Data<br />

The MessageConsumer can remove the message from the queue or topic without<br />

retrieving the message using the receiveNoData call. This is useful when the<br />

application has already examined the message, perhaps using the QueueBrowser.<br />

12-72 <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!