Enabling outbound messaging SendReceiveImmediate services

HCL Commerce can interact with other systems through the outbound messaging SendReceiveImmediate (formally Send/Receive) services. This allows HCL 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, HCL 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 IBM MQ.

To enable HCL 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, in HCL Commerce Version 9.0.0.x:
    
     <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"/>
     
    
    For Version 9.0.1 and later, use this example:
    <result name="OrderCreateXMLFormatView/0/-3" type="wcsstore">
    <param name="implClassName">com.ibm.commerce.messaging.viewcommands.MessagingViewCommandImpl</param>
    <param name="interfaceName">com.ibm.commerce.messaging.viewcommands.MessagingViewCommand</param>
    <param name="resourceClassName">com.ibm.commerce.messaging.viewcommands.MessagingViewCommand</param>
    <param name="properties">storeDir=no</param>
    <param name="direct">true</param>
    <param name="location">/OrderCreateXML.jsp</param>
    </result>

    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 IBM 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. HCL 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 HCL Commerce expects it to appear.
  3. HCL 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.