Skip Headers

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
Go To Table Of Contents
Contents
Go To Index
Index

Previous Next

12
Configuring Heterogeneous Inbound Message Propagation

After installing the Heterogeneous Message Propagation option, follow the instructions in this chapter to configure and use the Heterogeneous Inbound 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.

Heterogeneous Inbound Message Propagation option configuration tasks and other administrative topics include:

Overview of Inbound Message Propagation From MQSeries

Heterogeneous inbound propagation is accomplished in three steps:

  1. by dequeuing the messages from the MQSeries source queue using the gateway

  2. by translating the message service properties

  3. by enqueuing the messages in the Oracle AQ destination queue.

After the propagation schedule has started for a source and/or destination tuple,  the propagation process will make the necessary gateway procedure calls to establish a connection with the MQSeries Queue Manager, to open the source queue as described for the schedule, to dequeue the message, and to close the queue again.

For every message that is dequeued, the MQSeries service properties that are associated with the message are translated to Oracle AQ properties when applicable. 

Translation of MQSeries/Oracle AQ Interfaces

IBM MQSeries provides a set of services that is comparable to Oracle AQ.  For inbound message propagation, Heterogeneous Message Propagation will provide dynamic, best-effort translations of MQSeries interfaces and message service properties into Oracle AQ properties.  This section lists the Oracle AQ interface and message service properties that Oracle AQ applications can retrieve upon dequeuing a message.  The next section also describes how those interface and message service properties are translated from MQI (the native API for MQSeries applications).

Messages that are propagated from non-Oracle message queuing systems are available to Oracle AQ applications.  These messages may be retrieved by dequeuing them from the Oracle AQ destination queues by using the dequeue() procedure (refer to the Oracle AQ documentation for more details on the dbms_aq package).  Inbound propagation for MQSeries will use the following translations:

Translations for inbound propagation for MQSeries:

DBMS_AQ.DEQUEUE:

Table 12-1 DBMS_AQ.DEQUEUE

Oracle AQ Argument Translation for IBM MQSeries (inbound propagation)
queue_name N.A., this is the Oracle AQ destination queue.
dequeue_options Refer to table on dequeue_options_t next.
message_properties Refer to table on message_properties_t next.
payload The message data is propagated from MQSeries.  Inbound propagation supports only RAW payloads.

Note:  The maximum length of payload for MQSeries V2, V5, and Oracle AQ is (respectively) 4M, 100M, and 32K.  As such, payloads for inbound propagation are restricted to 32K.

msgid Not translated;

Note:  Although IBM MQSeries allows applications to set msgid, Oracle AQ does not support this.  Therefore, propagation of msgid values cannot be supported.

DBMS_AQ.DEQUEUE_OPTIONS_T

Upon dequeuing a message from an Oracle AQ destination queue using the dequeue() procedure, the Oracle AQ application can specify dequeue options.  Refer to Oracle8 Application Developer's Guide - Advanced Queuing for documentation on dbms_aq package.  Inbound propagation for MQSeries will use the following translations:

Table 12-2 DBMS_AQ.DEQUEUE_OPTIONS_T 

Oracle AQ Option Translation for IBM MQSeries (inbound propagation)
consumer_name For multiple-consumer queues, Oracle AQ applications can specify the consumer name that matches the consumer that is specified upon scheduling inbound propagation. If the queue is not set up for multiple consumers, then this field should be set to NULL.

Note: Also refer to dbms.hqadm.schedule_inbound_propagation().

dequeue_mode N.A. inbound propagation has no effect on this field.
navigation N.A. inbound propagation has no effect on this option.
visibility N.A. inbound propagation has no effect on this option.
wait N.A., inbound propagation has no effect on this option.
msgid Oracle AQ applications can specify the message ID that was assigned to the message by the Oracle AQ system.

Note:  Oracle AQ applications should not try to specify the message ID that was assigned to the message by the non-Oracle message queuing system. Propagation of msgid values is not supported.

correlation Oracle AQ applications can specify the correlation ID that was assigned to the message by the originating non-Oracle application.

DBMS_AQ.MESSAGE_PROPERTIES_T

Upon retrieving a message from an Oracle AQ destination queue using the dequeue() procedure, the Oracle AQ application receives a set of message properties.  Refer to Oracle8 Application Developer's Guide - Advanced Queuing for documentation on dbms_aq package.  The values for these properties are set by the inbound propagation process using the following translations:

Table 12-3 DBMS_AQ.MESSAGE_PROPERTIES_T 

Oracle AQ Property Translation for IBM MQSeries (inbound propagation)
priority Translated from MQMD.Priority.

Values 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 are translated respectively to 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,

delay No translation.
expiration Translated from MQMD.Expiry

Value MQEI_UNLIMITED translated to NEVER

Values in seconds -> tenth of seconds.

Note:  The expiration value in seconds is adjusted by subtracting the already-expired time since the message was enqueued at MQMD.PutDate and MQMD.PutTime in the MQSeries source queue.

correlation Translated from MQMD.CorrelId.
attempts No translation.
recipient_list No translation.
rxception_queue No translation.
enqueue_time No translation.

Note:  Upon propagation, the Oracle AQ system populates the enqueue_time field automatically.

state No translation.

Configuring Inbound Message Propagation

Configurations must be performed on the Oracle server, on the Oracle Procedural Gateway for IBM MQSeries, and on the IBM MQSeries to facilitate message propagation from an IBM MQSeries queue to an Oracle AQ queue. 

Oracle integrating server: Database link must be set up to point to the MQSeries gateway
Gateway: The gateway must be set up to be the proxy of the IBM MQSeries queue manager that owns the pickup queues
MQSeries: If the source queue is under the gateway queue manager, then no configuration is required.  Otherwise, the pickup queue must be created under the gateway queue manager, and a remote queue must be created in the source queue's queue manager to move messages to the pickup queue.

Figure 12-1 Inbound Scheduling

Description of 12_01.gif is contained in the surrounding text

The following configuration is required in order to propagate a message from IBM MQSeries queue 'ny11' under queue manager 'mgr.ny.1' over to Oracle Advanced Queue 'aq12' under Oracle server 'ora1':

Oracle integrating server: Database link pg4mq in ora1 to point to the MQSeries gateway
Gateway: Configure the gateway with queue manager mgr.gtw and set up strict security mode.
MQSeries: Create pickup queue pkup1 under queue manager mgr.gtw, create remote queue ny11 under queue manager mgr.ny.1 for remote queue pkup1, and create transmission queue under queue manger mgr.ny.1 to remote queue manager mgr.gtw, if it does not exist yet.

Operational Interface

Unlike outbound message propagation, as described in Chapter 11, no operational interface exists for Oracle applications to control inbound message propagation.  Control occurs at the administrative level only (refer to the next section), and the whole inbound message propagation process appears almost transparent to the receiving Oracle application.  Messages propagated into an Oracle AQ destination queue are dequeued in the same manner as any other message using the regular Oracle AQ interfaces as defined in the package DBMS_AQ.

Refer to the following code example with definitions of the Oracle AQ dequeue() procedure and the Oracle AQ types involved:


Oracle AQ procedures and types used in heterogeneous inbound message propagation:
dbms_aq.dequeue(
      queue_name          IN    varchar2,
      dequeue_options     IN    enqueue_options_t,
      message_properties  OUT   message_properties_t,
      payload             OUT   raw,
      msgid               OUT   raw)

TYPE dequeue_options_t IS RECORD (
     consumer_name        varchar2(30),
     dequeue_mode         binary_integer,
     navigation           binary_integer,
     visibility           binary_integer,
     wait                 binary_integer,
     msgid                raw(16),
     correlation          varchar2(128)) 

TYPE 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) 

Refer to the Oracle AQ documentation for detailed information on how to use the dequeue() procedure and its arguments.  For heterogeneous inbound message propagation, the usage is for the most part compatible with Oracle AQ propagation.  However, some arguments have different behavior due to the limited capabilities of non-Oracle message queuing systems.

The payload argument contains the application data.  The payload type should be compatible with the type of the queue specified in the queue_name argument, thus the payload type can be either an RAW or an ADT.  Heterogeneous inbound message propagation supports only RAW queues.  Therefore, only RAW payloads are supported. 

The msgid argument is a message identifier assigned to the message by the Oracle AQ system.  The msgid argument is globally unique within the Oracle domain.  Heterogeneous inbound message propagation cannot pass the original msgid along with the message to the Oracle AQ system.  For that reason, the msgid that is returned by the dequeue() procedure will not match the msgid that was assigned to messages by the non-Oracle message queuing system.  Similarly, the msgid that is specified in the dequeue_options argument should match the value that was assigned by the Oracle AQ system to the propagated message.  The msgid does not need to match the original value assigned by the non-Oracle message queuing system.

Although IBM MQSeries allows applications to set msgid, Oracle AQ and Microsoft MSMQ do not support this, because such propagation of msgid values cannot be supported.


Note:

Although IBM MQSeries allows applications to set msgid, Oracle AQ and Microsoft MSMQ do not support this, because such propagation of msgid values cannot be supported.

Oracle AQ applications can use the correlation field for point-to-point message identification.  The values of correlation will be preserved when they are propagated from non-Oracle message queuing systems to Oracle AQ.

An example of an Oracle application that is using the dequeue() procedure for a propagated message from MQSeries would look like the following:


Example
DECLARE

  dequeue_options DBMS_AQ.DEQUEUE_OPTIONS_T;
  message_properties DBMS_AQ.MESSAGE_PROPERTIES_T;
  message_handle RAW(16);
  message RAW(255);

BEGIN

  /* Specify correlation as assigned by the MQSeries appl.  */

  dequeue_options.correlation := 'AMQ qmgr.phx1029';

  /* dequeue the message from the AQ destination queue.  */

  DBMS_AQ.DEQUEUE(queue_name => 'aq2',
                  dequeue_options => queue_options,
                  message_properties => message_properties,
                  payload => message,
                  msgid => message_handle);

  COMMIT;

END;
/

Assuming that the Oracle AQ queue 'aq2' was used as the destination of an inbound message propagation schedule, the above example shows an Oracle AQ application attempting to dequeue a specific message from the destination queue by using correlation.  Because the messages in 'aq2' were sent by an MQSeries application, the specified correlation should match a value that was assigned to the messages by this application.  Considering this method of assigning correlation values, the Oracle application needs to take into account that the length of correlation values that are assigned by non-Oracle applications may differ from the length of correlation values that are assigned by an Oracle AQ.  Other dequeue options and message properties may have similar issues. 

Administrative Interface

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:

  1. an Oracle AQ source queue name

  2. the destination

  3. the scheduling times

As noted previously, inbound message propagation does not exist in homogeneous Oracle AQ propagation.  Therefore, the inbound message propagation mechanism has defined its own API with procedures to schedule/unschedule propagation.  The heterogeneous inbound administrative interface resembles the interface of homogeneous Oracle AQ propagation.

The procedures maintain schedules in dictionary tables.  These procedures are read by the inbound message 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_INBOUND_SCHEDULES (refer to Appendix D, " Heterogeneous Message Propagation DBA Views").  The package that contains the scheduling procedures (both outbound and inbound) is named DBMS_AQADM.  The following two procedures for inbound message propagation scheduling are defined in this package:

The two inbound scheduling procedures that are in the package are each composed of: name, purpose, syntax, usage, and error messages.  These two inbound scheduling procedures are described next.

Procedures for Inbound Message Propagation

Name:  SCHEDULE_INBOUND_PROPAGATION


Purpose

Upon calling, the procedure schedules propagation of messages from an non-Oracle AQ source queue to an Oracle AQ destination queue.


Syntax
dbms_hqadm.schedule_inbound_propagation(
      queue_name    in     varchar2,
      consumer      in     sys.aq$_agent,
      protocol      in     number,
      source        in     varchar2 default NULL,
      start_time    in     date default SYSDATE,
      duration      in     number default NULL,
      next_time     in     varchar2 default NULL,
      latency       in     number default 60 )

Usage
Parameter Description
queue_name specifies the Oracle AQ destination queue to which the messages will 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 inbound message propagation supports Oracle AQ destination queues of type RAW, and only type RAW.

consumer If a queue (named queue_name) is created as a multiple consumer queue, then the inbound message propagation process will set the consumer name of the propagated messages to the value specified with this argument.

If queue_name is not created as a multiple consumer queue, then this field should be set to NULL. 

Note:  Creating multiple inbound schedules with the same queue_name and source, but a different value for consumer, is not allowed.

protocol specifies the type of inbound message propagation protocol.

Valid values:  DBMS_HQADM.MQSERIES_INBOUND for IBM MQSeries.

source is used to specify the address of the designated ÒpickupÓ queue at the non-Oracle message queuing system.

Using Oracle gateways, the same database link mechanism that is used to specify a remote Oracle AQ server for homogeneous propagation can be used to specify a gateway for a non-Oracle message queuing system.

Syntax: <non_oracle_queue>@<database_link>

The syntax and length of the non-Oracle queue name are regulated by the non-Oracle message queuing system.  These queue-name properties may differ from those of Oracle AQ.

start_time Specifies the initial start time for the propagation window for messages from the source queue to the destination.
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 date function to compute the start of the next propagation window from the end of the current window.
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.

Error Messages

ORA-20001 An invalid value was specified for QUEUE_ADDRESS.  The value should be of the form queue@dblink[.domain]

Cause: The foreign queue specification for the source and/or destination parameter is either NULL or is not in the right format.

Action: Check the parameter, and correct the mistake.

ORA-20002 Heterogeneous propagation for ADT queues is not yet supported.

Cause: The Oracle AQ queue that was specified for heterogeneous propagation is an ADT queue, which is not supported.

Action: Specify a RAW queue.

ORA-20003 This error occurred while creating a MIP for this schedule.

Cause: The propagation package has a problem creating the interface to the foreign queue system for the schedule.

Action: This is an internal error.  Report this error to Oracle.

ORA-20006 A message consumer is not required for inbound message propagation into a single-consumer queue.

Cause: The consumer parameter has a non-NULL value, and the destination Oracle AQ queue is a single consumer queue.

Action: Give a NULL value to the consumer parameter.

ORA-20007 A Message Consumer is required for inbound message propagation into a multiple-consumer queue.

Cause: The consumer parameter has a NULL value, and the destination Oracle AQ queue is a multiple-consumer queue.

Action: Give a NULL value to the consumer parameter.

ORA-20008 An inbound schedule exists between the specified foreign source queue and the specified Oracle AQ queue.

Cause: The existing schedule must be removed first.

Action: Remove the old schedule before scheduling the new one.

Name: UNSCHEDULE_INBOUND_PROPAGATION


Purpose

The UNSCHEDULE_INBOUND_PROPAGATION procedure unschedules previously scheduled heterogeneous inbound message propagation from a non-Oracle source queue to an Oracle AQ destination.  If no messages are left in the propagation-exception queue, then it will be deleted again.  If the exception queue still holds messages, then the procedure will fail unless the user specifies the force option as TRUE (causing the messages on the propagation queue to be purged and causing the queue to be cleaned up).

Refer to "Exception Handling" for more information.


Syntax
dbms_hqadm.unschedule_propagation(
      queue_name   in      varchar2,
      protocol     in      number,
      source       in      varchar2 default NULL,
      force        in      boolean default FALSE)

Usage
Parameter Description
queue_name specifies the name of the destination queue whose inbound message propagation schedule should be ended. 

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.

protocol specifies the type of inbound message propagation protocol.

Valid values:  DBMS_HQADM.MQSERIES_INBOUND for IBM MQSeries.

source is used to specify the address of the designated ÒpickupÓ queue at the non-Oracle message queuing system whose inbound message propagation schedule should be ended.

Using Oracle gateways, the same database link mechanism that is used to specify a remote Oracle AQ server for homogeneous propagation can be used to specify a gateway for a non-Oracle message queuing system.

Syntax: <non_oracle_queue>@<database_link>

The syntax and length of the non-Oracle queue name are regulated by the non-Oracle message queuing system.  These queue-name properties may differ from those of Oracle AQ.

force specifies whether the procedure should succeed even if messages are left behind on the propagation-exception or transmit queues.

Refer to "Exception Handling" for more information.

Valid values:

TRUE: Any message that is left on the exception queue will be purged, and the queues will be cleaned up.

FALSE: The procedure will fail when messages are found on the exception queue.

Error Messages

ORA-20001 An invalid value was specified for QUEUE_ADDRESS.  The value should be of the form queue@dblink[.domain]

Cause: The foreign queue specification for the source or destination parameter (or both) is either NULL or is not in the right format.

Action: Check the parameter, and correct the mistake.

ORA-20009 No inbound schedule exists between the specified foreign source queue and the specified Oracle AQ queue.

Cause: The specified schedule cannot be found in the schedule table.

Action: Check the parameters.

Example

Continuing on the earlier example of scheduling propagation, the following code example demonstrates how Oracle AQ administrators would schedule homogeneous message propagation, heterogeneous outbound message propagation, and heterogeneous inbound message propagation.

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 =>'mq1@mqseries');

  /* schedule inbound propagation from MQSeries */

  DBMS_HQADM.SCHEDULE_INBOUND_PROPAGATION(
                        queue_name => 'aq2',
                        consumer   => 'JOE',
                        protocol   => DBMS_HQADM.MQSERIES_INBOUND,
                        source     => 'mq2@mqseries');
                        
END;
/

In the above example, inbound message propagation is scheduled for an MQSeries queue named 'mq2' and for an Oracle AQ destination queue named 'aq2'.  The source queue 'mq2' is accessed using an MQSeries gateway that is defined by the database link 'mqseries'.

Security

Heterogeneous Message Propagation does not impose new authorization requirements on either Oracle AQ or non-Oracle operational applications.  For inbound message propagation, a non-Oracle application enqueues the message to the designated source queue at the non-Oracle message queuing system, but does not require authorization for the recipient queue controlled by Oracle AQ.  Alternatively, the Oracle consumer application requires authorization only for the Oracle AQ destination queue.

At the administration level, the user who schedules inbound message propagation for a src_address and/or destination tuple:

The user name and password that were specified for the database link require access privileges at the message queuing system of the source 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 privileges, the propagation process can dequeue the messages from the source queue using the gateway and can enqueue them into the Oracle AQ destination queue.  This ensures that the security issue for inbound message propagation remains transparent to both sender and consumer applications.

Exception Handling

If the inbound message propagation process cannot propagate messages from the non-Oracle source queue to the Oracle AQ destination queue, the messages will be moved to a Òpropagation exceptionÓ queue.

propagation exception queue

For each schedule that is created by using the dbms_hqadm.schedule_inbound_propagation() procedure, an exception queue is created to stage messages that could not be successfully moved to the Oracle AQ destination queue.  Administrators can check the exception_queue field in the table DBA_INBOUND_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_inbound_propagation() procedure, the exception queue is removed again (for additional details, refer to the description of this procedure at "Name:  SCHEDULE_INBOUND_PROPAGATION").

Schedule Status

Status Information can be obtained for an inbound message propagation schedule and for individual messages.

Status of an Inbound Message Propagation Schedule

The administrator can check the view DBA_INBOUND_SCHEDULES to determine if inbound message propagation has been scheduled for a particular combination of Oracle AQ destination queue and non-Oracle source queue.  For each created schedule, the inbound message propagation process maintains the names of the exception queue as well as up to date status and statistics in the DBA_INBOUND_SCHEDULES view, among other information. 

For example, to find all schedules that are 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_INBOUND_SCHEDULES
WHERE DISABLED = 'Y';


Previous Next
Oracle Logo
Copyright © 2001, 2002 Oracle Corporation

All rights reserved
Go To Table Of Contents
Contents
Go To Index
Index