Skip Headers
Oracle® Application Server Integration B2B User's Guide
10g Release 2 (10.1.2.0.2)
B19370-01
  Go To Table Of Contents
Contents
Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Index
Index

Previous
Previous
Next
Next
 

15 Utilities for Enqueuing and Dequeuing

OracleAS Integration B2B provides two utilities to help you test and verify your installation and configuration before connecting to the host (back-end) applications. You can use these two utilities to learn how to send and receive business messages to and from OracleAS Integration B2B through the default AQ queue interface. Other AQ internal delivery channels can be handled in the same way. The Java enqueue and dequeue utilities are also used in the tutorial.

This chapter contains the following topics:

Java Enqueue and Dequeue

To enqueue and dequeue messages, use the following commands:

IPEnqueue and IPDequeue must be executed in the OracleAS Integration B2B environment. See "Setting Up the CLASSPATH Environment" for more information.

IPEnqueue

To enqueue messages using Java, execute the following at the command line:

java oracle.tip.adapter.b2b.data.IPEnqueue ipenqueue.properties

Table 15-1 lists the Java enqueue utility properties.

Table 15-1 IPEnqueue Properties

Name Description

queue

The outbound AQ queue name. If unspecified, the Java enqueue utility uses the default outbound queue IP_OUT_QUEUE.

replyToMsgID

The message ID to which the sending message is replying

from

Trading partner that sends the message

to

Trading partner that receives the message

doctypeName

Document type name for the message

doctypeRevision

Document type revision for the message

payload

Payload file name

attachment

Attachment file name


Example: ipenqueue.properties

queue           =
replyToMsgID    =
from            = "Acme"
to              = "GlobalChips"
doctypeName     = 850
doctypeRevision = 4010
payload         = Acme_850.xml
attachment      =

IPDequeue

To dequeue messages using Java, execute the following at the command line:

java oracle.tip.adapter.b2b.data.IPEnqueue ipdequeue.properties

Table 15-2 lists the Java dequeue utility properties.

Table 15-2 IPDequeue Properties

Name Description

queue

The inbound AQ queue name. If unspecified, the Java dequeue utility uses the default inbound queue IP_IN_QUEUE.

count

The number of messages to dequeue. If unspecified, only one message is dequeued.

output

Output file name


Example: ipdequeue.properties:

queue            =
count            = 1
output           = t1.trc

PL/SQL Enqueue and Dequeue

Use the following scripts to enqueue to and dequeue from B2B queues:

You must execute msgid_b2b.sql before enq_b2b.sql.

msgid_b2b.sql

The msgid_b2b.sql script creates a database sequence to generate a unique message ID for enqueue.

CREATE SEQUENCE message_seq INCREMENT BY 1 START WITH 1000;

enq_b2b.sql

The enq_b2b.sql script enqueues a message to a B2B queue. You can use either a VARCHAR2 or a CLOB as the message payload.

DECLARE
  enqueue_options                    dbms_aq.enqueue_options_t;
  message_properties                 dbms_aq.message_properties_t;
  msg_handle                         RAW(16);
  ipmsg                              IP_MESSAGE_TYPE;
  /* xml_payload                     varchar2(30000); */
  xml_clob                           clob;
  msg_id                             number(10);
  subscribers                        dbms_aq.aq$_recipient_list_t;
BEGIN
   select message_seq.nextval into msg_id from dual;
/* xml_payload                      :='<?xml version="1.0" encoding="UTF-8"?>'; */
   xml_clob                          := '<?xml version="1.0" encoding="UTF-8"?>';
   subscribers(1)                    := SYS.AQ$_AGENT('b2buser', null, null);
   message_properties.RECIPIENT_LIST := subscribers; 
   ipmsg                             := IP_MESSAGE_TYPE (msg_id, null,
            'Acme','GlobalChips','Process_850', '850', '4010', 1, xml_clob, null);
   dbms_aq.enqueue(queue_name         => 'IP_IN_QUEUE',
   enqueue_options                    => enqueue_options,
   message_properties                 => message_properties,    
   payload                            => ipmsg,
   msgid                              => msg_handle);
  commit;
END;
/
show errors;

deq_b2b.sql

The deq_b2b.sql script dequeues a message from a B2B queue.

DECLARE
  dequeue_options                 dbms_aq.dequeue_options_t;
  message_properties              dbms_aq.message_properties_t;
  message_handle                  RAW(16);
  ipmsg                           IP_MESSAGE_TYPE;
BEGIN
   dequeue_options.consumer_name  := 'b2buser';
   dequeue_options.dequeue_mode   := DBMS_AQ.REMOVE;
   dequeue_options.navigation     := DBMS_AQ.NEXT_MESSAGE;
   dequeue_options.wait           := DBMS_AQ.FOREVER;
   DBMS_AQ.DEQUEUE(
      queue_name                  => 'IP_IN_QUEUE',
      dequeue_options             => dequeue_options,
      message_properties          => message_properties,
      payload                     => ipmsg,
      msgid                       => message_handle);
   DBMS_OUTPUT.PUT_LINE('Message ID : ' || ipmsg.msg_id);
  COMMIT;
END; 
/
show errors;