WebSphere MQ Suite Close Session Service

The WebSphere MQ Suite Close Session service closes an existing session and disconnects from the WebSphere MQ Queue Manager.

The WebSphere MQ Suite Close Session service is used with the other WebSphere MQ Suite services to send and receive messages from a WebSphere MQ server. The following table provides an overview of the WebSphere MQ Suite Close Session service:

Category Description
System Name WSMQCloseSession
Graphical Process Modeler (GPM) categories) All Services, Messaging
Description Used as part of the WebSphere MQ Suite to close an existing session and disconnect from the WebSphere MQ Queue Manager.
Business usage Used with the other WebSphere MQ Suite services to send and/or receive messages from a WebSphere MQ server.
Usage example Should be called last after all other operations have been performed.
Preconfigured? Yes – a default instance is created during install, which can be used by all business processes. Default instance name is WSMQ_CloseSession.
Requires third-party files? com.ibm.mq.jar version 5.2.0 or higher and associated message catalog property files (i.e. mqji_en_US.property). These files need to be installed using install3rdParty.
Platform availability All supported Sterling B2B Integrator platforms
Related services
Related services:
  • WSMQOpenSession
  • WSMQOpenQueue
  • WSMQCloseQueue
  • WSMQPutMessage
  • WSMQGetMessage
  • WSMQCommit
  • WSMQBackout
Application requirements You must have a WebSphere MQ server.
Initiates business processes? No. This service does not invoke business processes or process any business process documents.
Invocation Invoke the default instance in a business process and specify the appropriate parameters
Business process context considerations If a session is opened but not closed, connections to the queue manager will remain open. Periodic checking for stale sessions is performed but it is still recommended that this service be placed in an OnFault handler (see bpml example below).
Returned status values Returned status values:
  • Success – Session closed and disconnected from the Queue Manager.
  • Error – This service never sets an error status.
Restrictions None
Persistence level Default
Testing considerations While testing this service, it is recommended to turn on debugging (wsmq_debug=Yes), which provides useful information if problems occur.

Implementing the WebSphere MQ Suite Close Session Service

There are no steps required for implementing this service. The default configuration, WSMQ_CloseSession, is ready for use as soon as Sterling B2B Integrator is installed.

Configuring the WebSphere MQ Suite Close Session Service

This service has no configurable parameters.

Parameters Passed From Business Process to Service

The following table contains the parameters passed from the business process to the WebSphere MQ Suite Close Session service:

Parameter Description
wsmq_sessionid The session identifier to use from a previously established session. Valid value is the value from a previously opened session. Required.

Business Process Example

The following example illustrates how the WebSphere MQ Suite Close Session service can be used in a business process:

<process name = "PUTexample">  
  <sequence name="OpenSession"> 
   <operation name="Open Session"> 
     <participant name="WSMQ_OpenSession"/> 
     <output message="toService"> 
       <assign to="." from="*"/> 
        <assign to="wsmq_hostname">some_host_name</assign> 
       <assign to="wsmq_channel">some_channel_name</assign> 
       <!-- <assign to="wsmq_debug">Yes</assign> --> 
     </output> 
      <input message="fromService"> 
       <assign to="." from="*"/> 
     </input> 
    </operation> 
 
   <sequence name="SessionOpened"> 
     <operation name="Open Queue"> 
       <participant name="WSMQ_OpenQueue"/> 
       <output message="toService"> 
         <assign to="wsmq_sessionid" from="string(wsmq_sessionid)"/> 
         <assign to="wsmq_qname">some_queue_name</assign> 
         <assign to="wsmq_MQOO_type">PUT</assign> 
         <assign to="wsmq_MQOO_failifquiescing">Yes</assign> 
       </output> 
        <input message="fromService"/> 
     </operation> 
 
     <operation name="PUT message(s)"> 
       <participant name="WSMQ_PutMessage"/> 
       <output message="toService"> 
         <assign to="." from="*"/> 
         <assign to="wsmq_qname">some_queue_name</assign> 
<!-- If neither two following assign's are specified, 
     the PrimaryDocument will be sent 
OR to perform batch sending, use the following assign: 
          <assign to="wsmq_batchFilter">*</assign> 
OR to send some other single document, use the following assign: 
         <assign to="wsmq_document" from="SomeDocumentName/@*"/> 
--> 
       </output> 
        <input message="fromService"> 
         <assign to="." from="*"/> 
       </input> 
      </operation> 
 
     <operation name="Commit the PUT"> 
       <participant name="WSMQ_Commit"/> 
       <output message="toService"> 
         <assign to="wsmq_sessionid" from="string(wsmq_sessionid)"/> 
       </output> 
        <input message="fromService"/> 
     </operation> 
 
     <operation name="Close Queue"> 
       <participant name="WSMQ_CloseQueue"/> 
       <output message="toService"> 
         <assign to="wsmq_sessionid" from="string(wsmq_sessionid)"/> 
         <assign to="wsmq_qname">some_queue_name</assign> 
       </output> 
        <input message="fromService"/> 
     </operation> 
 
     <sequence name="CloseSession"> 
       <operation name="Close Session"> 
         <participant name="WSMQ_CloseSession"/> 
         <output message="toService"> 
           <assign to="." from="*"/> <!—wsmq_sessionid passed by default --> 
          </output> 
         <input message="fromService"/> 
       </operation> 
      </sequence> 
 
     <onFault> 
        <operation name="Make sure session is closed"> 
          <participant name="WSMQ_CloseSession"/> 
          <output message="toService"> 
            <assign to="wsmq_sessionid" from="string(wsmq_sessionid)"/> 
         </output> 
          <input message="fromService"/> 
        </operation> 
     </onFault> 
    </sequence> <!-- end of SessionOpened sequence --> 
  </sequence> <!-- end of OpenSession sequence -->   
</process>