Enabling outbound messaging SendReceiveImmediate services

WebSphere Commerce can interact with other systems through the outbound messaging SendReceiveImmediate (formally Send/Receive) services. This allows WebSphere Commerce to send a message to another system and wait for a reply. The behavior of SendMsgCmd.sendReceiveImmediate() is similar to the SendMsgCmd.sendImmediate() method except that it waits for a return reply from the system receiving its message request.

About this task

After sending the request message, WebSphere Commerce listens to the inbound queue (by default, JMSInboundQueue) and waits until the reply message is placed on the queue with a correlation ID equal to the message ID of the request message.

You should use separate queues for SendReceiveImmediate from the queues used for the WebSphere Listener for WebSphere MQ.

To enable WebSphere Commerce to use the SendReceiveImmediate message service:

Procedure

  1. Create a message type in the MSGTYPES table for the new message used for the Send/Receive.
  2. To generate the outbound message, create an entry in the Struts configuration file to associate the VIEWNAME created in step 1 with a JSP file.

    For example,

    
     <forward className="com.ibm.commerce.struts.ECActionForward"
     name="OrderCreateXMLFormatView/0/-3" path="/OrderCreateXML.jsp">
     <set-property property="resourceClassName" value="com.ibm.commerce.messaging.viewcommands.MessagingViewCommandImpl"/>
     <set-property property="properties" value="storeDir=no"/>
     <set-property property="interfaceName" value="com.ibm.commerce.messaging.viewcommands.MessagingViewCommand"/>
     <set-property property="implClassName" value="com.ibm.commerce.messaging.viewcommands.MessagingViewCommandImpl"/>
     <set-property property="direct" value="true"/>
     
    

    The entry must use the following values:

    INTERFACENAME
    com.ibm.commerce.messaging.viewcommands.MessagingViewCommand
    CLASSNAME
    com.ibm.commerce.messaging.viewcommands.MessagingViewCommandImpl
    PROPERTIES
    docname= JSP filename

    The value in the "name" attribute is the VIEWNAME used to generate the message to send.

  3. Create a JSP file to generate the message to send to the outbound queue. This JSP file name should have been specified when a row is added to the Struts configuration file.
  4. Create or customize a command (task command only, if working with customization) that uses the SendMsgCmd.sendReceiveImmediate() mode and the message type ID created in step 1. This is used to call the SendMsgCmd interface.
  5. Use the Administration Console to ensure that the transport assigned to the SendReceiveImmediate service is active, such as the WebSphere MQ adapter.
  6. Use the Administration Console to define each message type that you created in step 1. In the Mode field specify 1. This indicates a SendReceiveImmediate mode of communication.

Results

After sending an outgoing message that requires a reply:

  1. WebSphere Commerce starts listening for a reply message on the target queue once the command to send the message is invoked.
  2. The third party application receives and consumes the message and generates a reply message containing a correlating ID that matches the message ID of the original request. It then places the reply message into the target queue where WebSphere Commerce expects it to appear.
  3. WebSphere Commerce finds the message containing the correlating ID that matches the message ID of the outgoing request message. The command then processes the payload of the reply message.