| Previous | Next |  | Contents | Index | Glossary

## Setting Up Queues

The Business Event System uses Oracle Advanced Queuing (AQ) to communicate event messages between systems. You must associate a queue with each agent you define in the Event Manager.

When you install Oracle Workflow, three standard queues are created automatically for the three standard Workflow agents. These queues all use the standard WF_EVENT_T structure as their payload type. See: Agents and Event Message Structure.

Queue Table | Queue Name | Description
--- | --- | ---
WF_IN | WF_IN | Default inbound queue
WF_OUT | WF_OUT | Default outbound queue
WF_ERROR | WF_ERROR | Default queue for error handling
Table 1 - 1. (Page 1 of 1)

You must not change the setup of these queues. However, you must schedule a listener for WF_ERROR to enable error handling for the Business Event System. Also, if you want to use WF_IN and WF_OUT for event message propagation, schedule a listener for WF_IN and a propagation for WF_OUT as well. See: Scheduling Listeners for Local Inbound Agents and Scheduling Propagations for Local Outbound Agents.

You can also set up your own queues for event message propagation. To set up a queue, you must create the queue table, create the queue, and start the queue.

- To create a queue table, use the PL/SQL procedure DBMS_AQADM.Create_Queue_Table. Use the following syntax:

    		DBMS_AQADM.Create_Queue_Table (

    			queue_table => '<queue table name>',

    			queue_payload_type => '<queue payload type>',

    			sort_list => 'PRIORITY,ENQ_TIME',

    			multiple_consumers => TRUE

    			compatible => '8.1');

For queues that you want use the standard Workflow format, specify the queue payload type as `WF_EVENT_T`. These queues can use the standard queue handler provided with Oracle Workflow, WF_EVENT_QH. If you define a queue with a different payload type, you must create a queue handler to translate between the standard Workflow format and the format required by the queue. See: Standard APIs for a Queue Handler.

You can also use the `storage_clause` parameter to specify the tablespace where you want to create the queue table. You may want to specify a tablespace if you expect a queue to be very large.

- To create a queue, use the PL/SQL procedure DBMS_AQADM.Create_Queue. Use the following syntax:

    		DBMS_AQADM.Create_Queue (

    			queue_name => '<queue name>',

    			queue_table => '<queue table name>');

> Note: If you want other database users to enqueue messages onto or dequeue messages from your queue, you must grant those users the appropriate privileges using the PL/SQL procedure DBMS_AQADM.Grant_Queue_Privilege.

- To start a queue, use the PL/SQL procedure DBMS_AQADM.Start_Queue. Use the following syntax:

    		DBMS_AQADM.Start_Queue (

    			queue_name => '<queue name>');

Oracle Workflow provides a sample script called wfevquec.sql which you can modify to set up your queues, as well as a sample script called wfevqued.sql which you can modify to drop queues. These scripts are located on your server in the Oracle Workflow sql subdirectory for the standalone version of Oracle Workflow, or in the sql subdirectory under $FND_TOP for the version of Oracle Workflow embedded in Oracle Applications.

You can use the Check Setup web page to verify that your queues are set up properly. See: Checking the Business Event System Setup.

> Note: SQL*Plus version 8.1.6 does not allow you to select the USER_DATA column from queue tables. You must have SQL*Plus version 8.1.7 or higher, which allows you to select USER_DATA, if you want to be able to select the event message payload from your Workflow queues.

### See Also

Administrative Interface, Oracle8i Application Developer's Guide - Advanced Queuing

DBMS_AQADM, Oracle8i Supplied PL/SQL Packages Reference

| Previous | Next |  | Contents | Index | Glossary