+

Search Tips   |   Advanced Search

Example: Code for closing a sequence


Your client application can use the WSRMSequenceManager, part of the WAS SPI for reliable messaging, to gain programmatic control over reliable messaging sequences. Use these code fragments as guidance for coding the reliable messaging client application to close a sequence.

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.

For the client application to gain programmatic control over reliable messaging sequences, it needs access to a WSRMSequenceManager instance. For information and example code explaining how to achieve this, see Controlling WS-ReliableMessaging sequences programmatically.

For a more complete spec of closing a sequence, see the WS-ReliableMessaging: supported specifications and standards.

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

 

Example

To close a WS-ReliableMessaging sequence use the following method on the WSRMSequenceManager:

  /**
   * Closes the Web services reliable messaging session from this application to 
   * the endpoint url specified.
   * 
   * Throws a WSRMSequenceTerminatedException if the session between this application 
   * and the target endpoint url is already closed
   * 
   * Throws a WSRMSequenceTerminatedException when the session between this application    * and the target endpoint has already been terminated.
   * 
   * Throws WSRMSequenceUnknownException exception when either reliable messaging is not engaged to 
   * the specified endpoint url or the sequence has previously been terminated and removed.
   * 
   * @param clientObject The JAX-WS Dispatch instance, or the Dynamic Proxy client instance. 
   * @param endPointUri The target endpoint url
   * 
   * @throws WSRMNotEnabledException    
   * @throws WSRMSequenceUnknownException 
   * @throws WSRMSequenceClosedException
   * @throws WSRMSequenceTerminatedException
   */
  public void closeSequence(Object clientObject, QName portQName, String endPointUri) 
  
  throws WSRMNotEnabledException, 
         WSRMSequenceUnknownException,          
         WSRMSequenceClosedException,          
         WSRMSequenceTerminatedException;






 

Related tasks


Learn about WS-ReliableMessaging
Controlling WS-ReliableMessaging sequences programmatically

 

Related


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