+

Search Tips   |   Advanced Search

Controlling WS-ReliableMessaging sequences programmatically


Your client application can use the WSRMSequenceManager, part of the WAS SPI for reliable messaging, to gain programmatic control over reliable messaging sequences. This helps manage resources on the server, for example by removing sequences after a client application has finished messaging. We can add code to create sequences, send acknowledgement requests, close sequences, terminate sequences and wait until sequences are complete.

The WAS SPI for reliable messaging always uses the static policy set configuration that is applied to the client from which the SPI is called. It does not use any alternative policy set that is subsequently configured by WS-Policy to meet the requirements of a WS-Policy intersection.

By closing sequences programmatically, you limit the number of open sequences a single client has to support in a single JVM at one time.

For the client application to gain programmatic control over reliable messaging sequences, it needs access to a WSRMSequenceManager instance. Use the following code fragment to achieve this:

import com.ibm.wsspi.wsrm.WSRMSequenceManager;  import com.ibm.wsspi.wsrm.WSRMSequenceManagerFactory;

.........

     
// Get the factory
     WSRMSequenceManagerFactory factory = WSRMSequenceManagerFactory
         .getInstance();

     
// Get the sequence manager instance
     WSRMSequenceManager sequenceManager = factory.createWSRMSequenceManager();
All WSRMSequenceManager methods take the following parameters:

To control WS-ReliableMessaging sequences programmatically, add code to the client application as described in the following steps:


Example: Code for creating a sequence
Example: Code for sending an acknowledgement request
Example: Code for closing a sequence
Example: Code for terminating a sequence
Example: Code for waiting for a sequence to complete

 

Related tasks


Learn about WS-ReliableMessaging
Detecting and fixing problems with WS-ReliableMessaging
Develop a reliable Web service application