Apache CXF API

org.apache.cxf.ws.rm
Class MessageCountingCallback

java.lang.Object
  extended by org.apache.cxf.ws.rm.MessageCountingCallback
All Implemented Interfaces:
MessageCallback

public class MessageCountingCallback
extends Object
implements MessageCallback

Implementation just counts the number of messages accepted for sending and the number acknowledged, allows checking / waiting for completion.


Constructor Summary
MessageCountingCallback()
           
 
Method Summary
 int getCountOutstanding()
          Get the number of messages accepted for sending which have not yet been acknowledged.
 void messageAccepted(String seqId, long msgNum)
           
 void messageAcknowledged(String seqId, long msgNum)
           
 boolean waitComplete(long timeout)
          Wait for all accepted messages to be acknowledged.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageCountingCallback

public MessageCountingCallback()
Method Detail

messageAccepted

public void messageAccepted(String seqId,
                            long msgNum)
Specified by:
messageAccepted in interface MessageCallback

messageAcknowledged

public void messageAcknowledged(String seqId,
                                long msgNum)
Specified by:
messageAcknowledged in interface MessageCallback

getCountOutstanding

public int getCountOutstanding()
Get the number of messages accepted for sending which have not yet been acknowledged.

Returns:
count

waitComplete

public boolean waitComplete(long timeout)
Wait for all accepted messages to be acknowledged.

Parameters:
timeout - maximum time to wait, in milliseconds (no timeout if 0)
Returns:
true if all accepted messages acknowledged, false if timed out

Apache CXF API

Apache CXF