Ending a message sequence

The end of a message sequence is determined by the End of sequence definition property on the Resequence and Sequence nodes.

Using a Resequence node

When you use the Resequence node to reorder messages in a message flow, you use the End of sequence definition property on the Resequence node to define how the reordered message sequence will end. You can specify the end sequence number in the Resequence node in one of the following ways:

As a literal number
Select Literal to specify a literal sequence number as the end of the sequence. This value can be any positive or negative numeric value in the range -9223372036854775807 to 9223372036854775807. When a message with the specified sequence number arrives, the sequence group is closed. If there are any messages missing from the sequence, the sequence group remains open for the period of time specified by the Missing message timeout property.
For example, assume that you have a Resequence node with the following properties:
  • Path to sequence number property with a value of /doc/seq
  • Path to sequence group identifier property with a value of /doc/grp
  • Start of sequence definition property set to Literal with a value of 0.
  • End of sequence definition property set to Literal with a value of 6. This value means that the group will be closed when a message with the sequence number 6 is received and when all earlier messages in the sequence have been received (or the missing message timeout expires).
The following messages are received by the Resequence node:
<doc><grp>a<grp><seq>6</seq></doc>
<doc><grp>a<grp><seq>5</seq></doc> 
<doc><grp>a<grp><seq>4</seq></doc> 
<doc><grp>a<grp><seq>3</seq></doc>
<doc><grp>a<grp><seq>2</seq></doc>
<doc><grp>a<grp><seq>1</seq></doc>
<doc><grp>a<grp><seq>0</seq></doc>
The following messages are propagated to the Out terminal:
<doc><grp>a<grp><seq>0</seq></doc>
<doc><grp>a<grp><seq>1</seq></doc>
<doc><grp>a<grp><seq>2</seq></doc>
<doc><grp>a<grp><seq>3</seq></doc>
<doc><grp>a<grp><seq>4</seq></doc>
<doc><grp>a<grp><seq>5</seq></doc>
<doc><grp>a<grp><seq>6</seq></doc>
When the sequence group has closed, any further messages arriving at the node for that sequence group are processed as part of a new instance of the group.
By an automatic timeout
Select Automatic and specify the length of time (in seconds) during which the node waits for new messages to arrive onto an empty queue. Each time the queue of messages waiting to be propagated is empty, the Resequence node starts a timer, which expires after the specified number of seconds. If no new messages arrive within the specified time, the sequence group is closed, and any new messages that arrive subsequently are treated as part of a new group. If new messages arrive at the node within the specified time limit, the timer is reset.
Using predicate set on the Resequence node
Select Predicate and specify an XPath expression to calculate whether the message is the last in the sequence. The predicate evaluates to either True or False, and messages continue to be collected while the expression evaluates to False. When the expression of a message is evaluated to True, it indicates that the message is the last in the sequence and the sequence group is closed. However, if earlier messages are missing from the sequence group, the sequence group remains open for the period of time specified by the Missing message timeout property.

When the sequence group has closed, any further messages arriving at the node for that sequence group are processed as part of a new instance of the group.

Typically, the XPath expression evaluates to a Boolean; however, if other data types are returned, the predicate is determined in the following way:
Table 1.
Returned data type True False
Boolean True False
Numeric Any non-zero value 0 or 0.0
String Any string matching true (case-insensitive) Any string not matching true (case insensitive)
NodeSet Never Always

When a message evaluates the expression to True (and is therefore identified as the last message in the sequence), the node checks that the message has the highest sequence number collected up to that point. If messages are found with higher sequence numbers, an exception is thrown.

Using a Sequence node

When you use the Sequence node to add sequence numbers to messages, you use the End of sequence definition property to define how the message sequence will end. The Sequence node allocates a monotonically increasing sequence number for each input message that arrives at the node, ending with the sequence number that you define in the End of sequence definition property.

You can specify the end sequence number in the Sequence node in one of the following ways:

As a literal number
Select Literal and specify a positive or negative numeric value as the end of sequence number (for example, 15). The value must be in the range -9223372036854775807 to 9223372036854775807. The monotonically increasing sequence ends when it reaches the end of sequence number specified by this property.
Using predicate set on the Sequence node
Select Predicate to specify that the sequence ends when the XPath expression evaluates to True. For more information, see the table above.
By an automatic timeout
Select Automatic and specify the length of time (in seconds) during which the node waits for new messages after a message for the sequence group has been propagated. If a new message arrives, the timer is canceled and reset when the message is propagated. If no new messages arrive within the specified time, the sequence group is closed, and any new messages that arrive subsequently are treated as part of a new group.