Adding sequence numbers to messages
You can add sequence numbers to messages entering a message flow by using the Sequence node.
Before you begin
Read the concept topic about Message sequencing.
About this task
The Sequence node allocates a monotonically increasing sequence number for each input message that arrives at the node. As each message arrives at the Sequence node, the sequence number is incremented and stored with the message in the location specified by the Path to store sequence number property. The allocation of sequence numbers continues until the sequence ends, as specified by the End of sequence definition property.
You can divide input messages into independent sequence groups, based on an identifier defined in the message. Each group has a separate group identifier, and the sequence of messages within each group is managed independently.
The Sequence node allocates a sequence number to each message in the sequence group, and the next sequence number in the group is not allocated until the current message in the group has finished processing (either by being committed or rolled back). This ensures that sequencing is maintained for the group when there are multiple threads in the message flow.
If you need to save the message with the newly assigned sequence number (for example, if you need to save the message to IBM MQ for processing by another flow), and if there is no convenient place in the message to save the sequence number, you can add an MQRFH2 header to the message before the Sequence node, and set the sequence number in a field in the usr folder.
Multiple sequence groups can be managed independently, in parallel, and sequence group state is preserved when the integration node is restarted.
The following steps show how to create a message flow that adds a sequence number to each message in a sequence group.