Example: Code for waiting for a sequence to complete

Your client application can take programmatic control of WS-ReliableMessaging sequences. Use the waitUntilSequenceCompleted method on the sequenceManager to ensure that reliable messaging state is released after the client finishes messaging.

Before you begin

For your 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.

Example

To wait for a reliable messaging sequence to complete, you use a method call that ensures that all messages have been sent and acknowledged by the target service. After the sequence is completed, it is terminated and cleaned up. This is good practice for any reliable messaging client application, and is essential for an unmanaged client application that is designed to exit after requests are made, as explained in the following troubleshooting tip: One-way requests from unmanaged clients are not delivered. By closing sequences programmatically, you limit the number of open sequences a single client has to support in a single JVM at one time. This helps avoid the problem described in the following troubleshooting tip: A client receives an out of memory exception message when working with large numbers of open sequences.

There are two ways of using the waitUntilSequenceCompleted method:




Related tasks
Learning about WS-ReliableMessaging
Controlling WS-ReliableMessaging sequences programmatically
Related reference
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
Reference topic Reference topic    

Terms and conditions for information centers | Feedback

Last updatedLast updated: Aug 31, 2013 1:23:07 AM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=pix&product=was-nd-dist&topic=rwbs_wsrm_prog_seq_wait
File name: rwbs_wsrm_prog_seq_wait.html