Download Oracle Streams Advanced Queuing User's Guide and Reference

Transcript
Propagating User-Enqueued LCRs from ANYDATA Queues to Typed Queues
■
CONVERT_ANYDATA_TO_LCR_DDL transforms an ANYDATA payload containing a DDL
LCR into a SYS.LCR$_DDL_RECORD payload.
The examples in this section set up propagation of row LCRs from an ANYDATA queue
named oe_queue_any to a typed queue of type SYS.LCR$_ROW_RECORD named oe_
queue_lcr. The source queue oe_queue_any is at database db01, and the destination
queue oe_queue_lcr is created at database db02 in Example 22–21.
The examples in this section assume you have already run the
examples in the preceding sections of this chapter.
Note:
Example 22–21 Creating a Queue of Type LCR$_ROW_RECORD
CONNECT strmadmin;
Enter password: password
BEGIN
DBMS_AQADM.CREATE_QUEUE_TABLE(
queue_table
=> 'strmadmin.oe_qtab_lcr',
queue_payload_type => 'SYS.LCR$_ROW_RECORD',
multiple_consumers => true);
DBMS_AQADM.CREATE_QUEUE(
queue_name
=> 'strmadmin.oe_queue_lcr',
queue_table => 'strmadmin.oe_qtab_lcr');
DBMS_AQADM.START_QUEUE(
queue_name
=> 'strmadmin.oe_queue_lcr');
END;
/
In Example 22–22, you connect to db01 as administrator user strmadmin to create an
ANYDATA to LCR$_ROW_RECORD transformation at db01 using the DBMS_TRANSFORM
package.
Example 22–22 Creating an ANYDATA to LCR$_ROW_RECORD Transformation
CONNECT strmadmin;
Enter password: password
BEGIN
DBMS_TRANSFORM.CREATE_TRANSFORMATION(
schema
=> 'strmadmin',
name
=> 'anytolcr',
from_schema
=> 'SYS',
from_type
=> 'ANYDATA',
to_schema
=> 'SYS',
to_type
=> 'LCR$_ROW_RECORD',
transformation =>
'SYS.DBMS_STREAMS.CONVERT_ANYDATA_TO_LCR_ROW(source.user_data)');
END;
/
In Example 22–23, you create a subscriber at the typed queue. The subscriber specifies
the anytolcr transformation created in Example 22–22 for the transformation
parameter.
Example 22–23 Creating Subscriber ROW_LCR_AGENT_REMOTE
DECLARE
subscriber
SYS.AQ$_AGENT;
Using ANYDATA Queues for User Messages 22-13