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.

TopicReceiver<br />

}<br />

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

}<br />

JMS Publish-Subscribe Model Features<br />

If the recipient name is explicitly specified in the recipient list, but that recipient is<br />

not a subscriber to the queue, then messages sent to it can be received by creating a<br />

TopicReceiver.TopicReceiver is an <strong>Oracle</strong> extension to JMS.<br />

A TopicReceiver can also be created with a message selector. This allows the<br />

client to restrict messages delivered to the recipient to those that match the selector.<br />

The syntax for the selector for TopicReceiver is the same as that for<br />

QueueReceiver.<br />

Example Scenario and Code<br />

public void ship_rush_orders(TopicSession jms_session)<br />

{<br />

Topic topic;<br />

TopicReceiver trec;<br />

ObjectMessage obj_message;<br />

BolCustomer customer;<br />

BolOrder new_order;<br />

String state;<br />

int i=0;<br />

try<br />

{<br />

/* get a handle to the OE_bookedorders_topic */<br />

topic = ((AQjmsSession)jms_session).getTopic("ES",<br />

"ES_bookedorders_topic");<br />

/* Create local subscriber - to track messages for some customers */<br />

trec = ((AQjmsSession)jms_session).createTopicReceiver(topic,<br />

"Fedex_Shipping",<br />

null);<br />

/* process 10 messages */<br />

for(i=0;i

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

Saved successfully!

Ooh no, something went wrong!