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.

Dequeue Features<br />

messages with the same correlation identifier, the ordering (enqueue order)<br />

between messages may not be preserved on dequeue calls. The correlation identifier<br />

cannot be changed between successive dequeue calls without specifying the first<br />

message navigation option.<br />

A dequeue condition is an expression that is similar in syntax to the WHERE clause<br />

of a SQL query. Dequeue conditions are expressed in terms of the attributes that<br />

represent message properties or message content. The messages in the queue are<br />

evaluated against the conditions and a message that satisfies the given condition is<br />

returned.<br />

A default dequeue means that the first available message for the consumer of a<br />

multiconsumer queue or the first available message in a single-consumer queue is<br />

dequeued.<br />

Note that dequeuing with correlation identifier, message identifier, or dequeue<br />

condition will not preserve the message grouping property (see "Message<br />

Grouping" on page 8-51 and "Message Navigation in Dequeue" on page 8-65 for<br />

more information).<br />

Scenario<br />

In the BooksOnLine example, rush orders received by the East shipping site are<br />

processed first. This is achieved by dequeuing the message using the correlation<br />

identifier, which has been defined to contain the order type (rush/normal). For an<br />

illustration of dequeuing using a message identifier, refer to the get_<br />

northamerican_orders procedure discussed in the example under "Modes of<br />

Dequeuing" on page 8-69.<br />

PL/SQL (DBMS_AQADM Package): Example Code<br />

CONNECT boladm/boladm;<br />

/* Create procedures to dequeue RUSH orders */<br />

create or replace procedure get_rushtitles(consumer in varchar2) as<br />

deq_cust_data BOLADM.customer_typ;<br />

deq_book_data BOLADM.book_typ;<br />

deq_item_data BOLADM.orderitem_typ;<br />

deq_msgid RAW(16);<br />

dopt dbms_aq.dequeue_options_t;<br />

mprop dbms_aq.message_properties_t;<br />

deq_order_data BOLADM.order_typ;<br />

qname varchar2(30);<br />

no_messages exception;<br />

A Sample Application Using AQ 8-59

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

Saved successfully!

Ooh no, something went wrong!