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.

Creating a Topic Receiver for a Topic of Standard JMS Type Messages<br />

Purpose<br />

Create a topic receiver for a topic of standard jms type messages.<br />

Usage Notes<br />

AQ allows messages to be sent to specified recipients. These receivers may or may<br />

not be subscribers of the topic. If the receiver is not a subscriber to the topic, it will<br />

receive only those messages that are explicitly addressed to it.<br />

This method must be used order to create a TopicReceiver object for consumers that<br />

are not 'Durable Subscribers'.A message selector can be specified. The syntax for the<br />

message selector is the same as that of a QueueReceiver for a queue of standard JMS<br />

type messages.<br />

Syntax<br />

Java (JDBC): <strong>Oracle</strong>9i Supplied Java Packages Reference oracle.jms,<br />

AQjmsSession.createTopicReceiver<br />

Example<br />

TopicConnectionFactory tc_fact = null;<br />

TopicConnection t_conn = null;<br />

TopicSession t_sess = null;<br />

TopicSession jms_sess;<br />

Topic shipped_orders;<br />

int myport = 5521;<br />

TopicReceiver receiver;<br />

/* create connection and session */<br />

tc_fact = AQjmsFactory.getTopicConnectionFactory("MYHOSTNAME",<br />

"MYSID", myport, "oci8");<br />

t_conn = tc_fact.createTopicConnection("jmstopic", "jmstopic");<br />

jms_sess = t_conn.createTopicSession(true, Session.CLIENT_ACKNOWLEDGE);<br />

shipped_orders = ((AQjmsSession )jms_sess).getTopic("WS", "Shipped_Orders_<br />

Topic");<br />

receiver = ((AQjmsSession)jms_sess).createTopicReceiver(shipped_orders,<br />

"WesternRegion", null);<br />

JMS Operational Interface: Basic Operations (Publish-Subscribe) 15-45

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

Saved successfully!

Ooh no, something went wrong!