|
Oracle® Procedural Gateway and Tools for IBM MQSeries Installation and User's Guide
Release 9.2.0.1.0 for UNIX Part No. A96196-01 |
|
After installing the Heterogeneous Message Propagation option, follow the instructions in this chapter to configure and use the Heterogeneous Outbound Message Propagation option. Heterogenous Services is a component of the Oracle9i server. You can also use the Oracle Messaging Gateway, which is included in the RDBMS bundle.
Configuration tasks and other administrative topics include:
Heterogeneous Outbound Message Propagation to MQSeries is accomplished in three steps:
After the propagation schedule has started for a source/destination tuple, the propagation process will use the Oracle AQ operational Application Programming Interface (API) to dequeue those messages that have specified a list of recipients or subscribers (if the queue has defined a list of subscribers), or the propagation process will use the Oracle AQ operational API to dequeue all messages from the source queue.
For every message dequeued, the Oracle AQ service properties that are associated with the message are translated (when applicable) to MQSeries properties. Examples of translated Oracle AQ service properties are queue table, queue, message, and enqueue properties.
After the message service properties are translated, the message is enqueued at the MQSeries destination queue. The Oracle9i Procedural Gateway for IBM MQSeries provides PL/SQLÔ access to MQSeries.
The outbound message propagation process will call the necessary gateway's procedure calls to perform the following tasks:
to establish a connection with the MQSeries Queue Manager
to open the MQSeries destination queue
to set the necessary MQSeries properties (as defined in the second step)
to enqueue the message
to close the queue again
IBM MQSeries provides a set of services that is comparable to the set of services that is provided by Oracle AQ. For outbound message propagation, Heterogeneous Message Propagation will provide dynamic, best-effort translations of Oracle AQ interfaces and message service properties into MQSeries properties. The next section lists the Oracle AQ interfaces, message service properties, and options that applications can specify upon enqueuing a message. The next section then describes how these items are translated to MQI (the native API for MQSeries applications).
Oracle AQ messages are entered into Oracle AQ queues using the enqueue() procedure (refer to the Oracle AQ documentation for more details on the dbms_aq package).
Oracle AQ queue properties and queue table properties are thought to have no impact on heterogeneous outbound message propagation. However, some queue properties and queue table properties are important for outbound message propagation and they are therefore listed here in Table 11-1 with the enqueue options and message properties.
Table 11-1 DBMS_AQ.ENQUEUE
Oracle AQ Queue Table properties are specified upon using the create_queue_table() procedure (refer to the Oracle AQ documentation for more details on the dbms_aqadm package). Outbound message propagation for MQSeries will use the following translations:
Table 11-2 DBMS_AQADM.CREATE_QUEUE_TABLE
Oracle AQ Queue properties are specified upon using the create_queue() procedure (refer to the Oracle AQ documentation for more details on the dbms_aqadm package). Outbound message propagation for MQSeries will use the following translations:
Table 11-3 DBMS_AQADM.CREATE_QUEUE
| Oracle AQ Property | Translation for IBM MQSeries (outbound propagation) |
|---|---|
queue_name
|
N.A. |
queue_table
|
N.A. |
queue_type
|
N.A. |
max_retries
|
N.A. |
retry_delay
|
N.A. |
retention_time
|
N.A. |
dependency_tracking
|
N.A. |
comment
|
N.A. |
auto_commit
|
N.A. |
Upon entering a message in the Oracle AQ source queue using the enqueue() procedure (refer to the Oracle AQ documentation on dbms_aq package), the Oracle AQ application can specify enqueue options. Outbound message propagation for MQSeries will use the following translations:
Table 11-4 DBMS_AQ.ENQUEUE_OPTIONS_T
Upon entering a message in the Oracle AQ source queue using the enqueue() procedure (refer to the Oracle AQ documentation on dbms_aq package), the Oracle AQ application can specify message properties. Outbound message propagation for MQSeries will use the following translations:
Table 11-5 DBMS_AQ.MESSAGE_PROPERTIES_T
Configuration is needed on the OracleÒ server, the Oracle Procedural GatewayÒ, and the IBM MQSeries to facilitate message propagation to an IBM MQSeries queue
| Oracle integrating server: | A database link must be set up to point to the MQSeries gateway. |
| Gateway: | The gateway must be set up to be the proxy of one IBM MQSeries queue manager (called 'gateway queue manager'), and must be run under strict security mode. |
| MQSeries: | If the target MQSeries queue is under the gateway queue manager, then no configuration is required. Otherwise, a remote queue must be created in the gateway queue manager to point to the target queue. |
Figure 11-1 Heterogeneous Outbound Message Propagation
To propagate a message from Oracle Advanced Queue 'aq12' under Oracle server 'ora1' over to IBM MQSeries queue 'ny11' under queue manager 'mgr.ny.1', the following configuration is required:
| Oracle server: | database link pg4mq in ora1 to point to the MQSeries gateway
|
| Gateway: | configure the gateway with queue manager mgr.gtw and setup strict security mode.
|
| MQSeries: | create remote queue xmit1 under queue manager mgr.gtw for the remote queue ny11 under queue manager mgr.ny.1, and create transmission queue and channels for the remote queue manager mgr.ny.1 if they do not already exist.
|
Oracle AQ allows propagation to be defined for queues and individual messages. This section describes how heterogeneous outbound message propagation will work for individual messages; the section hereafter will outline how outbound message propagation is configured for a queue.
For heterogeneous outbound message propagation of individual messages, we will re-use the Oracle AQ operational interface. Oracle AQ application will be able to specify non-Oracle consumers for a message using the standard recipient list mechanism. Upon enqueuing a message, the message_properties argument of the enqueue() procedure allows the Oracle AQ application to specify a list of recipients. For heterogeneous outbound message propagation, the fields of the structure used to specify the recipient will contain the communication information to access the non-Oracle AQ destination queue.
Refer to the next figure with definitions of the Oracle AQ enqueue() procedure and Oracle AQ types involved in this model:
dbms_aq.enqueue ( queue_name IN varchar2, enqueue_options IN enqueue_options_t, message_properties IN message_properties_t, payload IN raw, msgid OUT raw TYPE dbms_aq.enqueue_options_t IS RECORD ( visibility binary_integer, relative_msgid raw(16), sequence_deviation binary_integer) TYPE dbms_aq.message_properties_t IS RECORD ( priority binary_integer, delay binary_integer, expiration binary_integer, correlation varchar2(128), attempts binary_integer, recipient_list aq$_recipient_list, exception_queue varchar2(51), enqueue_time date, state binary_integer) TYPE dbms_aq.aq$_recipient_list_t IS TABLE OF sys.aq$_agent INDEX BY binary_integer TYPE dbms_aq.sys.aq$_agent IS OBJECT ( name varchar2(30), address varchar2(1024), protocol number)
Refer to the Oracle AQ documentation for detailed information on how to use the enqueue() procedure and its arguments. For heterogeneous outbound message propagation, the usage is generally compatible with Oracle AQ propagation. Some arguments have different behavior however, due to the limited capabilities of the non-Oracle message queuing system:
The payload argument contains the application data. The payload type should be in concert with the type of the queue specified in the queue_name argument and can either be RAW or ADT. Heterogeneous outbound message propagation supports only RAW queues. Therefore, only RAW payloads are supported.
The msgid argument is a message identifier assigned to a message by the Oracle AQ system. The msgid argument is globally unique within the Oracle domain. However, heterogeneous outbound message propagation cannot pass the msgid along with the message to the non-Oracle message queuing system. Although IBM MQSeries allows applications to set msgid, Oracle AQ does not support the IBM MQSeries method of setting msgid. For this reason, propagation of msgid values cannot be supported (because the msgid returned by the enqueue() procedure will not match the msgid of the propagated messages as assigned by the non-Oracle message queuing system).
|
Note: Oracle AQ applications can use thecorrelation field for message identification, and correlation values will be preserved when propagated to non-Oracle message queuing systems.
|
The sys.aq$_agent structure that is used to specify the recipient list of the message_properties argument plays a key role in heterogeneous outbound message propagation. Its fields are used to specify the non-Oracle destination queue of the recipients.
Table 11-6 sys.aq$_agent.usage
| Field | Description |
|---|---|
name
|
is a unique feature in Oracle AQ to identify the intended consumer of the message. The information is not forwarded to the non-Oracle message queuing system.
Note: Administrators use the name to track the propagation status of individual messages. |
address
|
is used to specify the non-Oracle destination queue and the communication path to access the non-Oracle queuing system. Using Oracle gateways, the same database link mechanism that is used to specify a remote Oracle AQ server in homogeneous Oracle AQ propagation is also used to specify a gateway for a non-Oracle message queuing system.
Syntax:
The syntax and maximum length of the non-Oracle queue name depend on the non-Oracle message queuing system and could differ from Oracle AQ. |
protocol
|
specifies the type of outbound message propagation protocol.
Valid value:
|
The following example demonstrates how the Oracle AQ operational interface can be used for both Oracle AQ and heterogeneous outbound message propagation. The code excerpt shows part of an Oracle AQ application that specifies both Oracle AQ and non-Oracle AQ consumers as recipients for a message entered into an Oracle AQ queue:
Example:
DECLARE
enqueue_options DBMS_AQ.ENQUEUE_OPTIONS_T;
message_properties DBMS_AQ.MESSAGE_PROPERTIES_T;
recipients DBMS_AQ.AQ$_RECIPIENT_LIST_T;
message_handle RAW(16);
message RAW(255) := 'something';
BEGIN
/* message receiver 1: queue aq1 at remote Oracle Database */
recipients(1) : = SYS.AQ$_AGENT('Joe', 'aq1@remoteAq', 0);
/* message receive 2: queue mq1 at MQSeries */
recipients(2) : = SYS.AQ$_AGENT('John',
'mq1@mqseries',
DBMS_HQADM.MQSERIES_OUTBOUND);
message_properties.recipient_list := recipients;
/* enqueue the message */
DBMS_AQ.ENQUEUE(queue_name => 'msg_queue',
enqueue_options => queue_options,
message_properties => message_properties,
payload => message,
msgid => message_handle);
COMMIT;
END;
/
The example propagates the same message to two different recipients:
As the protocol number 0 indicates, this is Oracle AQ propagation with the destination queue 'aq1' residing at a remote Oracle database referred to by database link 'remoteAq'. The intended consumer of the message is consumer 'Joe'.
Protocol DBMS_HQADM.MQSERIES_OUTBOUND indicates outbound message propagation from Oracle AQ to MQSeries. The destination is MQSeries queue 'mq1', which can be reached using the MQSeries gateway. The gateway is referred to by the database link 'mqseries'. Because MQSeries does not have the concept of message consumer, 'John' will be ignored during propagation.
Oracle AQ allows propagation to be defined for queues and individual messages. The previous section described how heterogeneous outbound message propagation works for individual messages. This section will define how to configure heterogeneous outbound message propagation for an Oracle AQ queue.
The Oracle AQ administrator's application will be able to specify non-Oracle consumers for an Oracle AQ queue using the standard subscriber mechanism. After having created a queue, the Oracle AQ administrator can use the add_subscriber() procedure to add a non-Oracle AQ subscriber. Subscribers are defined using a sys.aq$_agent structure.
|
Note: Propagation that is specified for individual messages using arecipient_list overrides heterogeneous subscribers that are specified for queues.
|
The next figure shows the definitions of the Oracle AQ add_subscriber() procedure and Oracle AQ structures that are used for specifying heterogeneous outbound message propagation for Oracle AQ queues.
DBMS_AQADM.ADD_SUBSCRIBER ( queue_name IN varchar2, subscriber sys.aq$_agent) TYPE sys.aq$_agent IS OBJECT ( name varchar2(30), address archar2(1024), protocol number)
Refer to the Oracle AQ documentation for detailed information on how to use the add_subscriber() procedure and its arguments. For heterogeneous outbound message propagation, the usage is generally compatible with Oracle AQ propagation. However, the sys.aq$_agent structure that is used to specify the subscriber plays a key role in heterogeneous outbound message propagation. Its fields are used to specify the non-Oracle destination queue of the subscriber.
Refer to Table 11-6, "sys.aq$_agent.usage" for a description of the sys.aq$_agent field for heterogeneous outbound message propagation.
The following example demonstrates how Oracle AQ and heterogeneous propagation can be specified using the same Oracle AQ administrative interface. The code example shows part of an Oracle AQ application that adds both Oracle AQ and non-Oracle AQ subscribers for an Oracle AQ queue:
DECLARE
subscriber SYS.AQ$_AGENT;
BEGIN
/* Add an AQ subscriber */
subscriber := SYS.AQ$_AGENT('Joe',
'aq1@remoteAq',
0);
DBMS_AQADM.ADD_SUBSCRIBER(queue_name => 'source_queue',
subscriber => subscriber );
/* Add an non-AQ subscriber */
subscriber := SYS.AQ$_AGENT('John',
'mq1@mqseries',
DBMS_HQADM.MQSERIES_OUTBOUND);
DBMS_AQADM.ADD_SUBSCRIBER(queue_name => 'source_queue',
subscriber => subscriber );
END;
/
The above example specifies an Oracle AQ and a non-Oracle AQ subscriber for 'source_queue' such that any message entered into the source queue will automatically be propagated to the following subscribers:
This will initiate Oracle AQ propagation, with the destination queue 'aq1' residing at a remote OracleÒ database referred to by database link 'remoteAq', and with the intended consumer of the message set to 'Joe'.
Protocol DBMS_HQADM.MQSERIES_OUTBOUND indicates outbound message propagation from Oracle AQ to MQSeries (refer to Table 11-6, "sys.aq$_agent.usage" for valid protocol numbers). The destination is an MQSeries queue 'mq1' that can be reached by the MQSeries gateway. The gateway is referred to by the database link 'mqseries'. Because MQSeries does not have the concept of message consumer, 'John' will be ignored during propagation.
For propagation in a homogeneous Oracle AQ environment, the administrator uses the Oracle AQ package DBMS_AQADM with procedures to schedule a propagation job. Specifying an Oracle AQ propagation job requires specifying three items:
an Oracle AQ source queue name
the destination
the scheduling times
The Oracle AQ administration package in Oracle 8.0.4 and Oracle 8.1 cannot yet accommodate heterogeneous protocols. For this reason, a separate scheduling package is used. This scheduling package has procedures for the scheduling and unscheduling of heterogeneous outbound message propagation. The procedures that are in this package resemble the Oracle AQ scheduling procedures.
The procedures maintain schedules in dictionary tables. These procedures are read by the propagation process to determine when a queue, and which queue, is due for another round of message propagation. The schedule information is available through a view named DBA_OUTBOUND_SCHEDULES (refer to Appendix D, " Heterogeneous Message Propagation DBA Views"). The package that contains the scheduling procedures (both inbound and outbound) is named DBMS_HQADM and contains two procedures for outbound message propagation:
SCHEDULE_PROPAGATION
UNSCHEDULE_PROPAGATION
The two outbound scheduling procedures that are in the package are each composed of a name, purpose, syntax, usage, and error messages. These two outbound scheduling procedures are described next.
Upon calling, the procedure schedules propagation of messages from an Oracle AQ source queue to a non-Oracle destination queue. If a message has multiple consumers at the same non-Oracle destination in the same or different queues, then the message will be propagated to all of them at the same time.
dbms_hqadm.schedule_propagation( queue_name in varchar2, protocol in number, destination in varchar2, start_time in date default SYSDATE, duration in number default NULL, next_time in varchar2 default NULL, latency in number default 60 )
| Parameter | Description |
|---|---|
queue_name
|
specifies the name of the source Oracle AQ queue whose messages are to be propagated. The name includes the schema name. If the schema name is not specified, then queue_name defaults to the schema name of the administrative user.
Note: Heterogeneous outbound message propagation supports queues of type RAW, and only type RAW. |
protocol
|
specifies the type of outbound message propagation protocol.
Valid values: |
destination
|
defines the foreign queue and database link to the gateway for accessing the non-Oracle message queuing system. Messages in the source queue for recipients at this destination will be propagated. If the name is not fully qualified, then the default domain name is used.
Note: Although NULL is accepted as a valid destination value for Oracle AQ propagation, NULL is not accepted as a valid destination value for heterogeneous outbound message propagation. |
start_time
|
specifies the initial start time for the propagation window for messages from the Oracle AQ source queue to the non-Oracle destination queue. |
duration
|
specifies the duration of the propagation window in seconds. A NULL value means that the propagation window is forever, or until the propagation is unscheduled. |
next_time
|
specifies the initial start time for the propagation window for messages from the Oracle AQ source queue to the non-Oracle destination queue. |
| latency | is the maximum wait, in seconds, in the propagation window for a message to be propagated after it is enqueued. However, if the latency is (for example) 60 seconds, and if no messages are waiting to be propagated, then during the propagation window, messages from that Oracle AQ source queue for the non-Oracle destination queue will not be propagated for at least 60 more seconds.
If the latency is 0, then the heterogeneous propagation process will be waiting for messages to be enqueued for the destination, and as soon as a message is enqueued, it will be propagated. |
queue@dblink[.domain]Cause: The foreign queue specification for the source and/or destination parameter is either NULL or not in the right format.
Action: Check the parameter, and correct the mistake.
This procedure for outbound message propagation unschedules previously scheduled heterogeneous outbound message propagation from an Oracle AQ source queue to a non-Oracle destination. If no messages are left on the propagation-exception queue or the transmit queue then these queues will be deleted. If these queues still hold messages, then the procedure will fail unless the user specifies the force option as TRUE, causing the messages to be purged and the queues to be cleaned up. Refer to the section on "Exception Handling" for more information about the propagation-exception and transmit queues.
dbms_hqadm.unschedule_propagation( queue_name in varchar2, protocol in number, destination in varchar2 default NULL, force in boolean default FALSE)
| Parameter | Description |
|---|---|
queue_name
|
specifies the name of the source queue whose outbound message propagation schedule should be ended.
The name includes the schema name. If the schema name is not specified, then |
| protocol | specifies the type of outbound message propagation protocol.
Valid values: |
destination
|
defines the database link to the gateway for accessing the non-Oracle message queuing system. Messages in the source queue for recipients at this destination will be propagated. If the name is not fully qualified, then the default domain name is used.
Note: Although NULL is accepted as a valid destination value for Oracle AQ propagation, for heterogeneous outbound message propagation, NULL is not accepted as a valid destination value. |
force
|
specifies whether the procedure should succeed even if messages are left behind on the propagation-exception or transmit queues.
Refer to the section on "Exception Handling" for more information about the propagation-exception and transmit queues. Valid values: TRUE: Any message that is left on the exception or transmit queue will be purged, and the queues will be cleaned up. FALSE: The procedure will fail when messages are found on either the exception or transmit queue. |
Continuing on the earlier example of using the Oracle AQ operational interface for both Oracle AQ and heterogeneous outbound message propagation, the following code example demonstrates how Oracle AQ administrators would schedule propagation for both.
BEGIN /* schedule propagation for AQ */ DBMS_AQADM.SCHEDULE_PROPAGATION(queue_name => 'aq1', destination => 'remoteAq'); /* schedule outbound propagation for MQSeries */ DBMS_HQADM.SCHEDULE_PROPAGATION(queue_name => 'mq1', protocol => DBMS_HQADM.MQSERIES_OUTBOUND, destination =>'QUEUE1@dblink'); END; /
Heterogeneous Message Propagation does not impose new authorization requirements on either Oracle AQ or non-Oracle operational applications. For outbound message propagation, a sending Oracle AQ application enqueues the messages into the source queue but does not require authorization for the recipient and/or subscriber's queue at the non-Oracle message queuing system. Non-Oracle consumers require authorization only for the non-Oracle AQ destination queue.
At the administration level, the user who schedules heterogeneous propagation for a source and/or destination tuple:
requires authorization to access the Oracle AQ source queue.
requires access to a database link for a gateway in order to access the destination queue at the non-Oracle message queuing system.
The user name and password specified for the database link require access privileges at the message queuing system of the destination queue. If the database link does not specify a user name and password, then it will implicitly use the ID of the current Oracle user.
Given these access privileges, the propagation process can dequeue the messages from the source queue and enqueue them through the gateway into the destination queue. This method of controlling access privileges ensures that the security issue for outbound message propagation remains transparent to both sender and consumer applications.
If the outbound message propagation process cannot propagate messages from the Oracle AQ source queue to their destination, then the messages will be moved to either a propagation exception queue or to an inactive transmit queue, as explained below.
For each schedule that is created by using the dbms_hqadm.schedule_propagation() procedure, an exception queue is created to stage messages that could not be successfully moved to the destination queue. Administrators can check the exception_queue field in the table DBA_OUTBOUND_SCHEDULES (refer to Appendix D, " Heterogeneous Message Propagation DBA Views") to obtain the name of this exception queue and to monitor it.
Upon unscheduling a propagation job by using the dbms_hqadm.unschedule_propagation() procedure, the exception queue is removed again (for full details, refer to the description of this procedure at "Name: UNSCHEDULE_PROPAGATION").
Inactive transmit queues are created by the propagation process upon encountering messages in a source queue for which no propagation has been scheduled yet. Administrators can check the transmit_queue field in the table DBA_OUTBOUND_SCHEDULES (refer to Appendix D, " Heterogeneous Message Propagation DBA Views") to obtain the name of this queue (if any) and monitor it.
Upon unscheduling a propagation job using the dbms_hqadm.unschedule_propagation() procedure, the inactive transmit queue is removed again (for full details, also refer to the description of this procedure).
The Oracle AQ API allows the propagation process to dequeue messages by protocol but not by destination or source. This means that messages with the same protocol but different destination or source are all dequeued at once. To avoid this, the propagation process must perform a 2-phase-commit when distributing messages to their respective destinations. The propagation process stages these messages into dedicated transmit queues. Each transmit queue is reserved for a particular schedule. If, however, no schedule was created for a message, and thus no transmit queue exists yet, then the propagation process creates an inactive transmit queue and moves the message in there.
Status Information can be obtained both for an outbound message propagation schedule and for individual messages.
The administrator can check the view, DBA_OUTBOUND_SCHEDULES, to determine if outbound message propagation has been scheduled for a particular combination of Oracle AQ source queue and non-Oracle destination queue. For each created schedule that the outbound message propagation process maintains in this view, the names of exception and transmit queues are included, as well as up to date status and statistics and other information.
For example, to find all schedules not running because of a failure, and to find the reason for the failure, the following query can be executed:
SELECT ERROR_TIME, ERROR, ERROR_MSG FROM DBA_OUTBOUND_SCHEDULES WHERE DISABLED = 'Y';
|
![]() Copyright © 2001, 2002 Oracle Corporation All rights reserved |
|