22 Utilities for Enqueuing and Dequeuing

Oracle B2B provides utilities to test and verify your installation and configuration before connecting to the host (back-end) applications. Use the utilities to learn how to send and receive business messages to and from Oracle B2B through the default AQ queue interface or the JMS queue interface. Other AQ internal delivery channels can be handled in the same way. See the B2B samples for examples of how to implement these utilities (See Section 1.7, "Oracle B2B Samples and Cookbooks," for information about the samples.)

This chapter contains the following topics:

22.1 AQ Enqueue and Dequeue Utilities

You can enqueue to and dequeue from an AQ queue using Java. IPEnqueue and IPDequeue must be executed in the Oracle B2B environment.

22.1.1 AQ Enqueue

Table 22-1 lists the Java AQ enqueue utility (oracle.tip.b2b.data.IPEnqueue) properties.

Table 22-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, typically used for the response message type.

from

Trading partner that sends the message

to

Trading partner that receives the message

doctypeName

Document type name for the message

doctypeRevision

Document protocol revision for the message

payload

Payload file name

ATTACHMENT_NAME

Attachment file name. Use this property to assign a name to the attachment file that is something other than the e-mail subject name.

For a custom outbound message over e-mail with AQ, do the following:

actionName=ATTACHMENT_NAME:Sample.txt

url

The database URL format is jdbc:oracle:thin:@host:port:sid

user

The database user

password

The database password

eventName

Action name

msgID

Message ID (optional). B2B generates its own message ID if it is not provided as part of an enqueue.

msgType

Provide an optional message type:

  • Request = 1 (default)

  • Response = 2

  • Functional Ack = 9

dateFormat

Used to convert the date format used in e-mail delivery channel

DYNAMICEMAIL

Provides the to party e-mail address as part of actionName. For example:

actionName=DYNAMICEMAIL:email_id

DYNAMIC_FROM_EMAIL

Provides the from party e-mail address as part of actionName. For example:

actionName=DYNAMIC_FROM_EMAIL:email_id

Example: ipenqueue.properties

queue           =
url             = jdbc:oracle:thin:@host:1521:sid
user             = user1
password         = password
replyToMsgID    =
from            = Acme
to              = GlobalChips
doctypeName     = 850
doctypeRevision = 4010
payload         = Acme_850.xml
attachment      =

Note:

In Windows ja_JP locale instances, the VARCHAR/String values are not enqueued correctly to the queue. The INT and CLOB values are enqueued correctly. This causes some fields, such as the from and to fields, to be null when the IPEnqueue utility is used to enqueue a file. As a workaround, in ja_JP locales, orai18n.jar should be added to the classpath while using oracle.tip.b2b.data.IPEnqueue.

22.1.2 AQ Dequeue

To dequeue messages, use the IPDequeue utility.

Table 22-2 lists the Java AQ dequeue utility (oracle.tip.b2b.data.IPDequeue) properties.

Table 22-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

url

The database URL format is jdbc:oracle:thin:@host:port:sid

user

The database user

password

The database password


Example: ipdequeue.properties:

queue            =
count            = 1
output           = t1.trc
url              = jdbc:oracle:thin:@host:1521:sid
user             = user1
password         = password

22.2 JMS Enqueue and Dequeue Utilities

You can enqueue to and dequeue from a JMS destination (queue or topic) using utilities. If a user name and password are not provided, the local JNDI is used, including in a clustered environment, provided that the destinations are distributed. Oracle B2B does not support javax.jms.ObjectMessage.

22.2.1 JMS Enqueue

Use the JMS enqueue utility, oracle.tip.b2b.data.JMSEnqueue, to send a message to a JMS destination (queue or topic). This utility expects a property file to be provided as a command-line argument where it reads the details to be sent.

Table 22-3 lists the properties that can be configured in the file.

Table 22-3 JMS Enqueue Properties

Name Description

destination

JNDI name of queue or topic to send message to

cf

JNDI name of connection factory to use

factory

Factory provider class

isTopic

Indicator for topic (optional)

url

The JNDI URL format is url=t3://host_name:port_number/

user

The application server administrator userID.

password

The application server administrator password

from

From party

to

To party

eventName

Action name

doctypeName

Document type name

doctypeRevision

Document type revision

payload

Payload file path

attachment

Attachment file path

msgID

Message ID (optional). B2B generates its own message ID if it is not provided as part of an enqueue.

replyToMsgID

Reply to message (optional)

msgType

Message type; the default is Request (optional).

ATTACHMENT_NAME

Attachment file name. Use this property to assign a name to the attachment file that is something other than the e-mail subject name.

For a custom outbound message over e-mail with JMS do the following:

constant : Sample.xml property : jca.jms.JMSProperty.ATTACHMENT_NAME

dateFormat

Used to convert the date format used in e-mail delivery channel

DYNAMICEMAIL

Provides the to party e-mail address. For example:

constant : email_id property : jca.jms.JMSProperty.DYNAMICEMAIL

DYNAMIC_FROM_EMAIL

Provides the from party e-mail address. For example:

constant : email_id property : jca.jms.JMSProperty.DYNAMIC_FROM_EMAIL

Example 22-1 shows the sample jms_enqueue.properties file.

Example 22-1 Sample jms_enqueue.properties File

####### Destination Details        #######
destination = jms/b2b/B2B_IN_QUEUE
cf = jms/b2b/B2BQueueConnectionFactory

####### Server and Factory Details #######
factory=weblogic.jndi.WLInitialContextFactory
url=t3://host_name:port_number/
#user=<uncomment and provide you username>
#password=<uncomment and proivde you password if required>

####### Payload Details #######
from=Acme
to=GlobalChips
#eventName=SampleEvent
doctypeName=Custom
doctypeRevision=1.0
payload=/scratch/work/GlobalChips_1234.dat

See the sample documentation for how to run these utilities.

22.2.2 Enqueue—Using a JMS JCA Adapter or Custom Utilities

The properties used by the AQ and JMS utilities are translated internally before the message is sent to the destination. Ensure that the properties in Table 22-4 are set as part of the javax.jms.Message delivered to the destination that B2B listens on.

Table 22-4 How AQ/JMS Properties Are Translated for Custom Utilities

AQ/JMS Utilities Translated Value—For Custom Utilities JMS Message

from

FROM_PARTY

Sent as a string type message property

to

TO_PARTY

Sent as a string type message property

doctypeName

DOCTYPE_NAME

Sent as a string type message property

doctypeRevision

DOCTYPE_REVISION

Sent as a string type message property

eventName

ACTION_NAME

Sent as a string type message property

msgID

MSG_ID

Sent as a string type message property

replyToMsgID

INREPLYTO_MSG_ID

Sent as a string type message property

msgType

MSG_TYPE

Sent as a string type message property

attachment

ATTACHMENT

Sent as a string type message property

payload

-

Sent as the message body


22.2.3 JMS Dequeue

The JMS dequeue utility, oracle.tip.b2b.data.JMSDequeue, receives messages from the destination. The count property can be specified to control the number of messages to be picked up from the destination. Retrieved messages are written to the file JMSDequeue.txt at the current path (where you run the utility).

See the samples documentation on Oracle Technology Network for how to run these utilities.

Example 22-2 shows the sample JMS dequeue properties file.

Example 22-2 Sample jms_dequeue.properties File

####### Destination Details#######
destination = jms/b2b/B2B_IN_QUEUE
cf = jms/b2b/B2BQueueConnectionFactory
count=1

####### Server and Factory Details #######
factory=weblogic.jndi.WLInitialContextFactory
url=t3://host_name:port_number/
#user=<uncomment and provide your username>
#password=<uncomment and provide your password if required>

22.3 Using the attachmentsDescriptor.xsd

Use the attachmentsDescriptor.xsd file for sending attachments.

Example 22-3 shows a sample attachment XML file.

Example 22-3 Sample Attachment XML File

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--Sample XML file generated by XMLSpy v2005 sp1 U  (http://www.xmlspy.com)-->
 <Attachments xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:noNamespaceSchemaLocation="AttachmentsDescriptor.xsd" version="1.0" boundary="boundary---">
        <AttachmentPart>
                <Location>file:///home/user_dir/data.xml</Location>
                <Content-Type>
                        <Top-Level-Type>text</Top-Level-Type>
                        <Sub-Type>plain</Sub-Type>
                        <Parameter Value="charset" Name="us-ascii"/>
                </Content-Type>
                <!--Content-Transfer-Encoding>BASE64</Content-Transfer-Encoding-->
                <Content-ID/>
                <Content-Description/>
        </AttachmentPart>
</Attachments>