|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Used for incoming messages. On client, it is always part of DuplexSequence
.
Nested Class Summary |
Nested classes inherited from class org.systinet.wasp.wsrm.sequence.OneWaySequence |
OneWaySequence.MessageState, OneWaySequence.State |
Field Summary |
Fields inherited from interface org.systinet.wasp.wsrm.sequence.OneWaySequence |
UNKNOWN_LENGTH |
Method Summary | |
void |
confirmCurrentMessage()
Explicitly confirms the current message. |
void |
confirmMessage(long messageNumber)
Explicitly confirms the given message. |
long |
getCurrentMessageNumber()
Returns the sequence number of the currently processed message. |
boolean |
isExplicitConfirmation()
Returns true when the explicit confirmation is enabled for this sequence. |
void |
setExplicitConfirmation(boolean explicitConfirmation)
Enables the application to express its interest in explicit confirmation of messages. |
Methods inherited from interface org.systinet.wasp.wsrm.sequence.OneWaySequence |
abort, getExpires, getLength, getMessageState, getState, getWireId, isActive, isExpired, isOutput, setActive |
Methods inherited from interface org.systinet.wasp.wsrm.sequence.Sequence |
getID, setExpires |
Method Detail |
public void setExplicitConfirmation(boolean explicitConfirmation) throws SequenceException
confirmCurrentMessage()
or confirmMessage(long)
; otherwise the messages will be treated as unconfirmed
and will be re-delivered to the application according to configured policy.
When the explicit confirmation is turned off (default), messages are implicitly
confirmed as soon as the service invocation ends. Application may be still interested in
earlier explicit input message confirmation in case the invocation takes longer time.
Note that messages are acknowledged as soon as they arrive to the destination machine.
Confirmation of a message removes it from the input queue, so the message will
not be processed second time in presence of server restart.
Explicit confirmation can be be setup in a sequence listener
:
private static class SequencesListener extends GenericSequenceListener { public void onCreate(OneWaySequence sequence) { if(!sequence.isOutput()) { // for input (incoming) sequences only try { ((InputSequence)sequence).setExplicitConfirmation(true); } catch (SequenceException e) { e.printStackTrace(); } } } }
SequenceException
confirmCurrentMessage()
,
confirmMessage(long)
public long getCurrentMessageNumber()
1
.
Note that you can distinguish the last message of sequence by the expression
sequence.getCurrentMessage() == sequence.getLength()
although
when not using in-order delivery assurance. This condition does not
guarantee that some out of order messages will not arrive later. In such case,
the expression sequence.getCurrentLength() == sequence.getLength()
hints that there will be no more messages in a sequence (but remember, there
can be a concurrent thread processing another message of the same sequence).
OutputSequence.getCurrentLength()
public boolean isExplicitConfirmation()
true
when the explicit confirmation is enabled for this sequence.
setExplicitConfirmation(boolean)
public void confirmCurrentMessage() throws SequenceException
MessageState#NOT_DELIVERED
to MessageState#DELIVERED
state.
SequenceException
setExplicitConfirmation(boolean)
public void confirmMessage(long messageNumber) throws SequenceException
MessageState#NOT_DELIVERED
to MessageState#DELIVERED
state.
SequenceException
- when attempting to confirm a non-existing message (i.e.
getMessageState(x) == OneWaySequence.MessageState.NOT_PRESENT
)setExplicitConfirmation(boolean)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |