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.

* Create local subscriber - for priority messages */<br />

tsubs = jms_session.createDurableSubscriber(topic, "PRIORITY",<br />

" JMSPriority > 1 ", false);<br />

obj_message = (ObjectMessage) tsubs.receive();<br />

JMS Propagation<br />

booked_order = (BolOrder)obj_message.getObject();<br />

customer = booked_order.getCustomer();<br />

System.out.println("Normal Order: for customer " + customer.getName());<br />

jms_session.commit();<br />

}<br />

catch (JMSException ex)<br />

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

}<br />

public void remote_subscriber1(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 "Priority" and address<br />

* the topic WS_booked_orders_topic at db2<br />

*/<br />

remote_sub = new AQjmsAgent("Priority", "WS.WS_bookedorders_topic@dblink_<br />

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

Creating Applications Using JMS 12-87

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

Saved successfully!

Ooh no, something went wrong!