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.

Message Transformation with JMS AQ<br />

}<br />

publisher = jms_session.createPublisher(topic);<br />

/* set the transformation in the publisher */<br />

((AQjmsTopicPublisher)publisher).setTransformation("OE2WS");<br />

publisher.publish(topic, adt_message);<br />

}<br />

catch (JMSException ex)<br />

{<br />

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

}<br />

Receiving Messages from a Destination Using a Transformation<br />

A transformation can be applied when receiving a message from a queue or topic.<br />

The transformation will be applied to the message before returning it to JMS<br />

application.<br />

The transformation can be specified using setTransformation( ) interface of the<br />

AQjmsQueueReceiver, AQjmsTopicSubscriber and<br />

AQjmsTopicReceiver.<br />

Example Code<br />

Lets say the Western Shipping application retrieves messages from the OE_<br />

bookedorders_topic. It specifies the transformation ’OE2WS’ to retrieve the message<br />

as the WS_order ADT.<br />

Lets say that the WSOrder Java class has been generated by Jpublisher to map to the<br />

<strong>Oracle</strong> Object WS.WS_order<br />

public AQjmsAdtMessage retrieve_booked_orders(TopicSession jms_session)<br />

AQjmsTopicReceiver receiver;<br />

Topic topic;<br />

Message msg = null;<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 a receiver for WShip */<br />

12-96 <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!