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.

Creating a Durable Subscriber for an ADT Topic without Selector<br />

Purpose<br />

Create a durable subscriber for an ADT topic without selector.<br />

Usage Notes<br />

To create a durable subscriber for a Topic of <strong>Oracle</strong> Object type, the client needs to<br />

specify the CustomDatumFactory for the <strong>Oracle</strong> Object Type in addition to the<br />

Topic and subscriber name.<br />

Syntax<br />

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

AQjmsSession.createDurableSubscriber<br />

Example<br />

subscribe to an ADT queue<br />

TopicConnectionFactory tc_fact = null;<br />

TopicConnection t_conn = null;<br />

TopicSession t_sess = null;<br />

TopicSession jms_sess;<br />

TopicSubscriber subscriber1;<br />

Topic shipped_orders;<br />

int my[port = 5521;<br />

AQjmsAgent[] recipList;<br />

/* the java mapping of the oracle object type created by J Publisher */<br />

ADTMessage message;<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("OE", "Shipped_Orders_<br />

Topic");<br />

/* create a subscriber, specifying the correct CustomDatumFactory */<br />

subscriber1 = jms_sess.createDurableSubscriber(shipped_orders,<br />

'WesternShipping', AQjmsAgent.getFactory());<br />

15-30 <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!