Use sequence groups to control the way in which messages are grouped together for processing by Sequence and Resequence nodes.
By default, all messages arriving at the Sequence and Resequence nodes are ordered as part of a single sequence group. However, you can divide messages into multiple sequence groups, based on a sequence group identifier in the message, and order each sequence group independently. For example, you might have a message flow that receives, processes, and forwards patient records. It is important that the order of records is maintained for each individual patient, but ordering between patients is not necessary. In this case, the sequence group identifier would be the name or ID of the patient.
The group to which a message belongs is determined by the group identifier that is specified in the message. You can use the Path to sequence group identifier property on the Sequence and Resequence nodes to specify the location of the sequence group identifier in the message.
Messages that have the same group identifier are considered part of the same sequence group. If no sequence group is specified, a single default sequence group is used for all messages. However, if the Path to sequence group identifier property specifies a location in the message that does not exist, an error occurs.
Each sequence group can be associated with only one Sequence node. Multiple nodes can have a sequence group with the same name, but each of those sequence groups is associated with only one node and is separate from other groups with the same name on different nodes. For example, SequenceNode1 might have a sequence group called GroupA, and SequenceNode2 might also have a sequence group called GroupA, but they are separate groups.
Although you can reuse sequence groups when they have been closed, there is a risk that two occurrences of the same sequence group could overlap, with unpredictable results.
For example, if you have a sequence group including the numbers 1-10 and the group is used twice in close succession, it is possible for the second occurrence of sequence number 1 to arrive before sequence number 10 of the first occurrence. If this happens, a duplicate message exception occurs. For this reason, it is advisable to use a group name for only one set of sequence numbers, rather than reusing it in a Resequence node. If you do decide to reuse a sequence group, ensure that you reuse it only when you can be certain that the preceding use has been finished for a significant amount of time.
Even if all the numbers have been received by the first occurrence of the group, it can be difficult to know for certain exactly when the group is closed because it closes only when the final message has completely finished processing; this includes any processing that is required downstream of the node. Any message from the second occurrence fails as a duplicate unless all processing is complete. When a sequence group has started overlapping, it is very difficult to recover all the messages (in both uses of the group) in the correct order, although no messages are lost).