Skip Headers

Oracle Workflow API Reference
Release 2.6.3.5

Part Number B12163-02
Previous Next       Contents Index Glossary
         Previous  Next          Contents  Index  Glossary

DequeueOutbound

Syntax

procedure DequeueOutbound

    (dequeuemode in number,
navigation in number default 1,
correlation in varchar2 default null,
itemtype in varchar2 default null,
payload out system.wf_payload_t,
message_handle in out raw,
timeout out boolean);

Description

Dequeues a message from the outbound queue for some agent to consume.

Attention: If you call this procedure within a loop, you must remember to set the returned message handle to null, otherwise, the procedure dequeues the same message again. This may not be the behavior you want and may cause an infinite loop.

Arguments (input)

dequeuemode A value of DBMS_AQ.BROWSE, DBMS_AQ.LOCKED, or DBMS_AQ.REMOVE, corresponding to the numbers 1, 2 and 3 respectively, to represent the locking behavior of the dequeue. A mode of DBMS_AQ.BROWSE means to read the message from the queue without acquiring a lock on the message. A mode of DBMS_AQ.LOCKED means to read and obtain a write lock on the message, where the lock lasts for the duration of the transaction. A mode of DBMS_AQ.REMOVE means read the message and delete it.
navigation Specify DBMS_AQ.FIRST_MESSAGE or DBMS_AQ.NEXT_MESSAGE, corresponding to the number 1 or 2 respectively, to indicate the position of the message that will be retrieved. A value of DBMS_AQ.FIRST_MESSAGE retrieves the first message that is available and matches the correlation criteria. The first message is inherently the beginning of the queue. A value of DBMS_AQ.NEXT_MESSAGE retrieves the next message that is available and matches the correlation criteria, and lets you read through the queue. The default is 1.
correlation Specify an optional correlation identifier for the message to be dequeued. Oracle Advanced Queues allow you to search a queue for messages based on a specific correlation value. You can use the Like comparison operator, '%', to specify the identifier string. If null, the Workflow Engine creates a correlation identifier based on the Workflow schema name and the item type.
itemtype The item type of the event.
message_handle Specify an optional message handle ID for the specific event to be dequeued. If you specify a message handle ID, the correlation identifier is ignored.

Attention: The timeout output returns TRUE when there is nothing further to read in the queue.

Example

Following is an example of code that loops through the outbound queue and displays the output.

declare

event system.wf_payload_t;
i number;
msg_id raw(16);
queuename varchar2(30);
navigation_mode number;
end_of_queue boolean;

begin
queuename:=wf_queue.OUTBOUNDQUEUE;
i:=0;
LOOP
i:=i+1;

-- always start with the first message then progress to next
if i = 1 then
navigation_mode := dbms_aq.FIRST_MESSAGE;
else
navigation_mode := dbms_aq.NEXT_MESSAGE;
end if;

-- not interested in specific msg_id. Leave it null so
--as to loop through all messages in queue
msg_id :=null;

wf_queue.DequeueOutbound(
dequeuemode => dbms_aq.BROWSE,
payload => event,
navigation => navigation_mode,
message_handle => msg_id,
timeout => end_of_queue);

if end_of_queue then
exit;
end if;

-- print the correlation itemtype:itemKey
dbms_output.put_line('Msg '||to_char(i)||' = '||
event.itemtype||':'||event.itemkey
||' '||event.actid||' '
||event.param_list);
END LOOP;

end;
/


         Previous  Next          Contents  Index  Glossary



Oracle Logo
Copyright © 2003, 2004, Oracle. All rights reserved.