Sending JMS messages in real time
By ACShorten on Oct 28, 2011
One of the features of the framework is the ability to send data to a JMS resource (Queue or Topic) from a business event in the product in real time. The idea is that some business event occurs, such as data changing or a status changing, which is picked up by an algorithm or other program object and then an outbound message created to be sent by the JMS Real Time Senders we supply in the product. The real time sender deposits the message on the JMS within the transaction context.
To do this a number of objects need to be setup:
- Create a XAI JNDI Server entry with the JNDI sever for your JMS Resources
- Create a XAI JMS Connection entry with your JMS connection factory and referring to the XAI JNDI Server you created.
- Create a XAI JMS Queue/Topic entry to connect to the JMS Connection and JNDI Server. You will also need to provide credentials if necessary in the Context tab (if your JMS resource is secured).
- Configure a XAI JMS Sender entry of type RTJMSQSNDR referring to the JMS Connection, and JMS Queue/Topics you defined.
- Create an Outbound Message Type entry you want to use to define your transaction and refer to the object you want to use as the primary object to send the data out on.
- Create an External System definition which links the Outbound Message Type to the JMS Sender you created. This tells the product to process the messgae of that type to the JMS resources you defined.
- Decide the appropriate algorithm to use to detect the business even that occurs. Of course you can use class extensions or server user exits as well as objects to detect a business event but algorithms are the most commonly used.
- Build a Business Object schema against the Outbound Messae (F1-OUTMSG) maintenance object. In the XML_SOURCE XML object you can define the structure you want to send to the JMS resource. Specify the External System in the NT_XID_CD element and Outbound Message Type in the OUTMSG_TYPE_CD element as defaults. The schema should be somewhat similar to the example below (this is used to send To Do status messages to BAM for example):
<externalSystem mapField="NT_XID_CD" fkRef="F1-ESTMP" default="XXXSYS"/>
<outboundMessageType mapField="OUTMSG_TYPE_CD" fkRef="F1-OMTYP" default="XXXMSG"/>
<todoPackage type="group" mapXML="XML_SOURCE">
- Create the algorithm to populate the elements of the schema above and use invokeBO to create the outbound message. This will then appear in the JMS Queue or Topic in real time. Note: If the JMS Queue/Topic is not available at runtime then the transaction may fail as it assumes the JMS is now part of the transaction.
The first part of the process is all definition of the JMS resources within XAI. The Sender, Business Object and Algorithm are the key elements for the interface. The data for the outbound message is not restricted to one object, your algorithm can get data from as many objects as you want to build the message. The key is to define the message elements in the XML Source XML element.
For more information about JMS Outbound refer to the Oracle WebLogic JMS Integration and Oracle Utilities Application Framework (Doc Id: 1308181.1) whitepaper available from My Oracle Support.