Examples of Sending Messages to External Systems

Automation simplifies the process of sending messages to external systems. The automation framework does the following:

  • Assumes the protocol is JMS. The products (Siebel, OSM, UIM, ASAP, IP Service Activator) all have JMS APIs.

  • Takes care of establishing and maintaining the various JMS connections.

  • Constructs the JMS messages, setting the required message properties.

  • Guarantees delivery of the message and handles any errors or exceptions. It retries until the message is delivered.

  • Automatic message correlation.

  • Poison message handling.

An OSM event that is sent to an external system follows this process flow:

  1. OSM runs an automation that triggers an automation plug-in.

  2. Internally, the automation framework maps the plug-in, using the automationMap.xml configuration, onto custom business logic and calls the makeRequest method on the custom automator class.

  3. The makeRequest method performs some business logic and sets the content of the outbound message.

  4. The automation framework adds properties to the outbound message to aid in correlating external system responses to requests.

  5. The automation framework uses information from the automationMap.xml to send the JMS message to the JMS queue representing the external system.

The following example shows a custom automation plug-in that sends data to an external system.

 package com.mslv.oms.sample.atm_frame;
 
 import com.mslv.oms.automation.plugin.*;
 import com.mslv.oms.automation.*;
 import javax.jms.TextMessage;
 import java.rmi.*;
 
 public class ObjectelPlugin extends AbstractSendAutomator {
 
 protected void makeRequest(String inputXML, AutomationContext context, TextMessage outboundMessage) throws com.mslv.oms.automation.AutomationException {

 try {
 TaskContext taskContext = (TaskContext)context;
 String taskName = taskContext.getTaskMnemonic();
 AtmFrameCatalogLogger.logTaskEvent(taskName, taskContext.getOrderId(), taskContext.getOrderHistoryId(), inputXML);

 //
 // Set the outgoing message
 //
 String xmlRequest = "<Message type=\"ni\"><iLibPlus:findFunctionalPortOnLocation.Request xmlns:iLibPlus=\"http://www.oracle.com/objectel\"><location><DS><AG2ObjectID>189438</AG2ObjectID><AG2ParentID>189428</AG2ParentID><CLLIX>XML.CO.1</CLLIX><SiteName>XML.CO.1</SiteName></DS></location><feType>PP</feType><portType>$FEP</portType><selectionMethod>LOAD_BALANCE</selectionMethod><portSelectionAttribName><string>AG2ObjectID</string><string>AG2ParentID</string><string>AG2PortLabel</string></portSelectionAttribName><portSelectionAttribValue><string>189508</string><string>189478</string><string>F-31-OC-48</string></portSelectionAttribValue><portUpdateAttribName/><portUpdateAttribValue/></iLibPlus:findFunctionalPortOnLocation.Request></Message>";
 outboundMessage.setText( xmlRequest );

 } catch( javax.jms.JMSException x ) {
 throw new AutomationException( x );
 } catch(RemoteException ex){
 throw new AutomationException( ex );
 }
 }
 }

The following code snippets from this example show:

  • how to generate an output XML string. In this example it is hard coded. In a business case you would use business logic to transform OSM data into what the external system expects

     String xmlRequest = "<Message type=\"ni\"><iLibPlus:findFunctionalPortOnLocation.Request xmlns:iLibPlus=\"http://www.oracle.com/objectel\"><location><DS><AG2ObjectID>189438</AG2ObjectID><AG2ParentID>189428</AG2ParentID><CLLIX>XML.CO.1</CLLIX><SiteName>XML.CO.1</SiteName></DS></location><feType>PP</feType><portType>$FEP</portType><selectionMethod>LOAD_BALANCE</selectionMethod><portSelectionAttribName><string>AG2ObjectID</string><string>AG2ParentID</string><string>AG2PortLabel</string></portSelectionAttribName><portSelectionAttribValue><string>189508</string><string>189478</string><string>F-31-OC-48</string></portSelectionAttribValue><portUpdateAttribName/><portUpdateAttribValue/></iLibPlus:findFunctionalPortOnLocation.Request></Message>";
    
  • how to set the output data:

     outboundMessage.setText( xmlRequest );
    
  • How this code does not establish a connection to an external system or send a message. After the data is set in the code, the message is automatically sent upon exit of the makeRequest method.