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 Message Producer Features<br />

}<br />

Message Grouping<br />

obj_message.setObject(back_order);<br />

tpub = jms_session.createPublisher(null);<br />

/* Set message expiration to 7 days: */<br />

timetolive = 7*60*60*24*1000; // specified in milliseconds<br />

/* Publish the message */<br />

tpub.publish(back_order_topic, obj_message, DeliveryMode.PERSISTENT,<br />

1, timetolive);<br />

jms_session.commit();<br />

}<br />

catch (Exception ex)<br />

{<br />

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

}<br />

Messages belonging to a queue/topic can be grouped to form a set that can only be<br />

consumed by one consumer at a time. This requires the queue/topic be created in a<br />

queue table that is enabled for transactional message grouping (see "Creating a<br />

Queue Table", Chapter 9, "Administrative Interface"). All messages belonging to a<br />

group have to be created in the same transaction and all messages created in one<br />

transaction belong to the same group. Using this feature, you can segment a<br />

complex message into simple messages. This is an AQ extension and not part of the<br />

JMS specification.<br />

For example, messages directed to a queue containing invoices could be constructed<br />

as a group of messages starting with the header message, followed by messages<br />

representing details, followed by the trailer message. Message grouping is also very<br />

useful if the message payload contains complex large objects such as images and<br />

video that can be segmented into smaller objects.<br />

The general message properties (priority, delay, expiration) for the messages in a<br />

group are determined solely by the message properties specified for the first<br />

message (head) of the group irrespective of which properties are specified for<br />

subsequent messages in the group.<br />

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