Debugging Applications that Use the Event-Driven Publishing API

Using Event-Driven Publishing 21-9 plist_object := SRW_PARAMLIST_OBJECTplist; … Then we enqueue the message using the enqueue procedure provided by Advanced Queuing. … dbms_aq.enqueuequeue_name = myQueue, enqueue_options = enqueue_options, message_properties = message_properties, payload = PList_Object, msgid = message_handle; … The message is put into the queue. Because we did not set up any message distribution, the message will stay in the queue until it is fetched by a dequeuing-procedure, which is discussed in the next section.

21.4.3 Creating the Dequeuing Procedure

A dequeuing procedure reads out all available messages in a queue and processes them. In our case, we want to read out the message and submit a job to the server using the parameter list that was attached to the message. To accomplish this, we follow this example: BEGIN dequeue_options.wait := 1; loop DBMS_AQ.DEQUEUEqueue_name = myQueue, dequeue_options = dequeue_options, message_properties = message_properties, payload = PList_Object, msgid = message_handle; COMMIT; plist := plist_object.params; r_jid := SRW.RUN_REPORTplist; end loop; exception when aq_timeout then begin NULL; end; END; This code example will read out the queue until all messages have been processed. Time allowed for processing is determined by the timeout defined in the second line of code. This timeout defines the amount of seconds the dequeue procedure should wait for a message before creating a timeout exception. The DBMS_AQ.DEQUEUE built-in is provided by Advanced Queuing for reading out messages. It puts the payload of the message, the object that holds the information, into the object defined by the payload parameter. Note: For the exact syntax of dbms_aq.enqueue refer to the Advanced Queuing API Reference document. Youll find additional examples in the srwAQsetup.sql file included with your Oracle Reports Services installation. 21-10 Publishing Reports to the Web with Oracle Reports Services Using plist, we extract the information from the payload object. As mentioned before, our object holds a parameter list. It is stored in the attribute PARAMS inside the object. The extracted parameter list is then handed over to SRW.RUN_REPORT for submitting the job. If you want to avoid the need for invoking this dequeuing procedure by hand, you can run it as a job inside the database.