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.

JMS Point-to-Point Model Features<br />

The selector for queues containing payloads of type TextMessage,<br />

StreamMessage, BytesMessage, ObjectMessage, MapMessage can contain<br />

any expression that has a combination of one or more of the following:<br />

JMSMessageID =’ID:23452345’ to retrieve messages that have a specified<br />

<br />

message ID (all message IDs being prefixed with ID:)<br />

JMS Message header fields or properties:<br />

<br />

JMSPriority < 3 AND JMSCorrelationID = ’Fiction’<br />

JMSCorrelationID LIKE ’RE%’<br />

User-defined message properties:<br />

<br />

color IN (’RED’, BLUE’, ’GREEN’) AND price < 30000<br />

For queues containing AdtMessages the selector must be a SQL expression on the<br />

message payload contents or message ID or priority or correlation ID.<br />

Selector on message id - to retrieve messages that have a specific message ID<br />

<br />

msgid = ’23434556566767676’<br />

Note: in this case message IDs must NOT be prefixed with ’ID:’<br />

Selector on priority or correlation is specified as follows<br />

<br />

priority < 3 AND corrid = ’Fiction’<br />

Selector on message payload is specified as follows<br />

<br />

tab.user_data.color = ’GREEN’ AND tab.user_data.price < 30000<br />

Example Scenario and Code<br />

In the BOL application, new orders are retrieved from the new_orders_queue.<br />

These orders are then published to the OE.OE_bookedorders_topic. After<br />

creating a JMS connection and session, you create a receiver to receive messages:<br />

public void get_new_orders(QueueSession jms_session)<br />

{<br />

QueueReceiver receiver;<br />

Queue queue;<br />

ObjectMessage obj_message;<br />

BolOrder new_order;<br />

BolCustomer customer;<br />

String state;<br />

String cust_name;<br />

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