Previous |
Next |
Create a queue table and a queue to store the messages that the first application will generate for the second application. After the queue is created, message notification requires a consumer who can dequeue messages from the queue. In this example, a messaging client is the consumer who can dequeue messages from the streams_queue
queue.
To configure a queue and a messaging client:
Create a queue named streams_queue
in the schema of the Oracle Streams administrator. See "Creating an ANYDATA Queue" for instructions.
On a command line, open SQL*Plus and connect to the database as the Oracle Streams administrator.
See Starting SQL*Plus and Connecting to the Database for more information about starting SQL*Plus.
Create a messaging client to enable the Oracle Streams administrator to dequeue messages from the streams_queue
queue:
BEGIN DBMS_STREAMS_ADM.ADD_MESSAGE_RULE ( message_type => 'strmadmin.app_info', rule_condition => ':MSG.VALUE >= 0', streams_type => 'DEQUEUE', streams_name => 'strmadmin', queue_name => 'strmadmin.streams_queue'); END; /
The user name for the Oracle Streams administrator must be specified for the streams_name
parameter. In this example, the user name for the Oracle Streams administrator is strmadmin
. The name of the new messaging client is also strmadmin
.
A messaging client uses rules to determine which messages to dequeue. In this example, the rule for the messaging client specifies that all messages with a value
greater than zero should be dequeued. So, with this rule, the messaging client will dequeue all new messages of type strmadmin.app_info
that appear in strmadmin.streams_queue
because all parameter values are greater than or equal to zero.
Complete the steps in "Task 3: Configuring a Mechanism for Dequeuing Messages" to continue this extended example.