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.

}<br />

Message Transformation with JMS AQ<br />

receiver = ((AQjmsSession)jms_session).createTopicReceiver(topic,<br />

"WShip, null, WSOrder.getFactory());<br />

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

receiver.setTransformation("OE2WS");<br />

msg = receiver.receive(10);<br />

}<br />

catch (JMSException ex)<br />

{<br />

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

}<br />

return (AQjmsAdtMessage)msg;<br />

Specifying Transformations for Topic Subscribers<br />

A transformation can also be specified when creating Topic Subscribers using the<br />

CreateDurableSubscriber call. The transformation is applied to the retrieved<br />

message before returning it to the subscriber. If the subscriber specified in the<br />

CreateDurableSubscriber already exists, it’s transformation is set to the<br />

specified transformation.<br />

Example Code<br />

The Western Shipping application subscribes to the OE_bookedorders_topic with<br />

the transformation ’OE2WS’. This transformation is applied to the messages and the<br />

returned message is of <strong>Oracle</strong> Object type WS.WS_orders.<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 />

{<br />

TopicSubscriber subscriber;<br />

Topic topic;<br />

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

Creating Applications Using JMS 12-97

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

Saved successfully!

Ooh no, something went wrong!