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 />

Use dbms_AQadm.Create_Queue_Table <strong>to</strong> create <strong>the</strong> physical table in <strong>the</strong><br />

database. You must pass it a name for <strong>the</strong> table and a name for <strong>the</strong> object type that will<br />

define <strong>the</strong> message for this queue.<br />

For example:<br />

…<br />

execute dbms_AQadm.Create_Queue_Table<br />

(queue_Table=>'queuename._tab',<br />

queue_Payload_Type=>'SRW_PARAMLIST_OBJECT',<br />

compatible=>'9.0');<br />

In earlier examples, we created <strong>the</strong> object type SRW_PARAMLIST_OBJECT that<br />

encapsulates <strong>the</strong> SRW_PARAMLIST type in object notation so it can be used as a<br />

message.<br />

After creating <strong>the</strong> queue table, you must create <strong>the</strong> queue with dbms_<br />

AQadm.Create_Queue and start <strong>the</strong> queue with dbms_AQadm.Start_Queue.<br />

For example:<br />

…<br />

execute dbms_AQadm.Create_Queue<br />

(Queue_Name=>'queuename',Queue_Table=>'queuename._tab');<br />

prompt … starting queue<br />

execute dbms_AQadm.Start_Queue<br />

(Queue_Name=>'queuename');<br />

…<br />

Having created and started <strong>the</strong> queue, what you need now is a procedure that creates<br />

a message in this queue and a procedure that reads out <strong>the</strong> queue and submits <strong>the</strong> job<br />

<strong>to</strong> <strong>the</strong> server. These are discussed in <strong>the</strong> following sections.<br />

17.4.2 Creating <strong>the</strong> Enqueuing Procedure<br />

The enqueuing procedure is responsible for putting a message in<strong>to</strong> <strong>the</strong> queue. This<br />

procedure can be part of your application, called by a database-trigger, or provided via<br />

an external mechanism. In this section, we will provide an example of creating a s<strong>to</strong>red<br />

procedure that puts a simple message in this queue.<br />

Because our message is <strong>the</strong> parameter list itself, <strong>the</strong> procedure is fairly easy. We use <strong>the</strong><br />

same code we used in earlier sections <strong>to</strong> create a parameter list. In addition <strong>to</strong> <strong>the</strong><br />

variables we used, we define an object variable <strong>to</strong> hold <strong>the</strong> message we will put in<strong>to</strong><br />

<strong>the</strong> queue.<br />

…<br />

…<br />

Note: You'll find a complete example for setting up, creating, and<br />

starting a simple queue in <strong>the</strong> demo file srwAQsetup.sql,<br />

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

plist_object SRW_ParamList_Object;<br />

After creating <strong>the</strong> parameter list we create <strong>the</strong> actual message object using <strong>the</strong> object<br />

construc<strong>to</strong>r.<br />

…<br />

plist_object := SRW_PARAMLIST_OBJECT(plist);<br />

…<br />

17-8 <strong>Oracle</strong> Application Server <strong>Reports</strong> Services <strong>Publishing</strong> <strong>Reports</strong> <strong>to</strong> <strong>the</strong> <strong>Web</strong>

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

Saved successfully!

Ooh no, something went wrong!