01.02.2013 Views

Publishing Reports to the Web - Downloads - Oracle

Publishing Reports to the Web - Downloads - Oracle

Publishing Reports to the Web - Downloads - 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.

Integrating with <strong>Oracle</strong> Advanced Queuing<br />

Then we enqueue <strong>the</strong> message using <strong>the</strong> enqueue procedure provided by Advanced<br />

Queuing.<br />

…<br />

dbms_aq.enqueue(queue_name => 'myQueue',<br />

enqueue_options => enqueue_options,<br />

message_properties => message_properties,<br />

payload => PList_Object,<br />

msgid => message_handle);<br />

…<br />

The message is put in<strong>to</strong> <strong>the</strong> queue. Because we did not set up any message<br />

distribution, <strong>the</strong> message will stay in <strong>the</strong> queue until it is fetched by a<br />

dequeuing-procedure, which is discussed in <strong>the</strong> next section.<br />

17.4.3 Creating <strong>the</strong> Dequeuing Procedure<br />

Note: For <strong>the</strong> exact syntax of dbms_aq.enqueue refer <strong>to</strong> <strong>the</strong><br />

Advanced Queuing API Reference document.<br />

You'll find additional examples in <strong>the</strong> srwAQsetup.sql file<br />

included with your <strong>Oracle</strong>AS <strong>Reports</strong> Services installation.<br />

Look for upcoming information about <strong>Reports</strong> APIs on <strong>the</strong> <strong>Oracle</strong><br />

Technology Network, (http://otn.oracle.com).<br />

A dequeuing procedure reads out all available messages in a queue and processes<br />

<strong>the</strong>m. In our case, we want <strong>to</strong> read out <strong>the</strong> message and submit a job <strong>to</strong> <strong>the</strong> server<br />

using <strong>the</strong> parameter list that was attached <strong>to</strong> <strong>the</strong> message.<br />

To accomplish this, we follow this example:<br />

BEGIN<br />

dequeue_options.wait := 1;<br />

loop<br />

DBMS_AQ.DEQUEUE(queue_name => 'myQueue',<br />

dequeue_options => dequeue_options,<br />

message_properties => message_properties,<br />

payload => PList_Object,<br />

msgid => message_handle);<br />

COMMIT;<br />

plist := plist_object.params;<br />

r_jid := SRW.RUN_REPORT(plist);<br />

end loop;<br />

exception when aq_timeout <strong>the</strong>n<br />

begin<br />

NULL;<br />

end;<br />

END;<br />

This code example will read out <strong>the</strong> queue until all messages have been processed.<br />

Time allowed for processing is determined by <strong>the</strong> time-out defined in <strong>the</strong> second line<br />

of code. This time-out defines <strong>the</strong> amount of seconds <strong>the</strong> dequeue procedure should<br />

wait for a message before creating a time-out exception.<br />

The DBMS_AQ.DEQUEUE built-in is provided by Advanced Queuing for reading out<br />

messages. It puts <strong>the</strong> payload of <strong>the</strong> message, <strong>the</strong> object that holds <strong>the</strong> information,<br />

in<strong>to</strong> <strong>the</strong> object defined by <strong>the</strong> payload parameter.<br />

Using Event-Driven <strong>Publishing</strong> 17-9

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

Saved successfully!

Ooh no, something went wrong!