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

oe_ws from database db1, the order entry database, to the western shipping<br />

database db2. The WS_bookedorders_topic at db2 is a remote subscriber to the<br />

OE_bookedorders_topic in db1.<br />

Example Scenario for Case 2<br />

Assume the order entry application and Western region shipping application are on<br />

different databases, db1 and db2. Further assume that there is a dblink dblink_<br />

oe_ws from the local order entry database db1 to the western shipping database<br />

db2. The agent "Priority" at WS_bookedorders_topic in db2 is a remote<br />

subscriber to the OE_bookedorders_topic in db1. Messages propagated to the<br />

WS_bookedorders_topic are for "Priority" only.<br />

public void remote_subscriber(TopicSession jms_session)<br />

{<br />

Topic topic;<br />

ObjectMessage obj_message;<br />

AQjmsAgent remote_sub;<br />

try<br />

{<br />

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

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

"OE_bookedorders_topic");<br />

/* create the remote subscriber, name unspecified and address<br />

* the topic WS_booked_orders_topic at db2<br />

*/<br />

remote_sub = new AQjmsAgent(null, "WS.WS_bookedorders_topic@dblink_oe_<br />

ws");<br />

/* subscribe for western region orders */<br />

((AQjmsSession)jms_session).createRemoteSubscriber(topic, remote_sub,<br />

"Region = ’Western’ ");<br />

}<br />

catch (JMSException ex)<br />

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

catch (java.sql.SQLException ex1)<br />

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

}<br />

Database db2 - shipping database: The WS_booked_orders_topic has two<br />

subscribers, one for priority shipping and the other normal. The messages from the<br />

Order Entry database are propagated to the Shipping database and delivered to the<br />

correct subscriber. Priority orders have a message priority of 1.<br />

Creating Applications Using JMS 12-85

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

Saved successfully!

Ooh no, something went wrong!