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.

Message Transformation with JMS AQ<br />

from_schema => ’OE,<br />

from_type => ’OE_order’,<br />

to_schema => ’WS’,<br />

to_type => ’WS_order’,<br />

transformation => ’OE_order(source.user_data.customer.name, \<br />

source.user_data.customer.street, \<br />

source.user_data.customer.city, \<br />

source.user_data.customer.state, \<br />

source.user_data.customer.country, \<br />

source.user_data.customer.zipcode, \<br />

source.user_data.customer.country, \<br />

source.user_data.orderno, \<br />

source.user_data.status, \<br />

source.user_data.ordertype, \<br />

source.user_date.items, \<br />

TO_CHAR(source.user_date.order_date, ’MM:DD:YYYY’))’);<br />

Sending Messages to a Destination Using a Transformation<br />

A transformation can be supplied when sending/publishing a message to a<br />

queue/topic. The transformation will be applied before putting the message into<br />

the queue/topic.<br />

The application can specify a transformation using the setTransformation<br />

interface in the AQjmsQueueSender and AQjmsTopicPublisher interfaces.<br />

Example Code<br />

Lets say that the orders that are processed by the order entry application should be<br />

published to the WS_bookedorders_topic.<br />

The transformation OE2WS (defined in the previous section) is supplied so that the<br />

messages are inserted into the topic in the correct format.<br />

public void ship_booked_orders(TopicSession jms_session,<br />

AQjmsADTMessage adt_message)<br />

{<br />

TopicPublisher publisher;<br />

Topic topic;<br />

try<br />

{<br />

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

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

"WS_bookedorders_topic");<br />

Creating Applications Using JMS 12-95

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

Saved successfully!

Ooh no, something went wrong!