Sequencer component is used to retain the sequence of messages when a certain section of the flow has to be processed in multiple threads or flows for performance concerns. When messages are split into parallel flows or multiple sessions are used in component(s), the messages are not guaranteed to reach the end of the flow in the order of their arrival. A pair of sequencer components launched in Generate and Resequence modes respectively ensures the order is maintained.
Configuration
Sequencer Mode
...
It has two options—Generate and Resequence. The first option is used to generate a sequence starting from the given Initial Sequence Number. Resequence sorts all the messages as it is stored in the sorted map. Hence, they appear in the order of their arrival. This is most useful in a Multithreaded environment.
Sequence Holder Property
...
The property by which the messages are compared.
Notification Interval
...
Duration for which the message is retained in the component.
Resequence Interval
...
Interval after which resequencing is attempted.Intial
Initial Sequence Number
...
Number from which sequence starts. By default, it is set to 1.
Sequence Type
The two sequence types are:
- Continuous: Select this to have two consecutive sequence numbers differ by 1.
- Non-Continuous: Sequence numbers are not generated continuously.
Sequence Numbering on Component Restart
...
The previous run count will be considered if 'the Continue from previous run' option option is chosen, else the run count is started from initial Sequence Number set in the CPS.
Number of Parallel Flows
...
The number of parallele parallel flows connected to the sequencer component. The number is used to generate a property PARALLEL_FLOW_INDEX whose value is equal to Generated Sequence Number modulus the value provided here. The property PARALLEL_FLOW_INDEX is then used in the flow to set JMS selectors on routes leading to each of the parallel flows
For example, if the number of flows is '2' as seen in functional demonstration section, one route will have JMS selector as PARALLEL_FLOW_INDEX=1 and the other one will have PARALLEL_FLOW_INDEX=2.
...
Tip | ||
---|---|---|
| ||
For the solution to work even when components are restarted, the following changes have to be made.
|
...
The following figure demonstrates a skeleton use case of sequencing. The parallel flows are wrapped between sequencer and resequencer components with the number of flows set in the configuration of both sequenceer sequencer and resequencer.
Filters are appropriately set on routes so that each parallel flow receives correspnding the corresponding message.
Sample Output
Useful Tips
- Notification Interval, Resequence Interval, and Sequence Type properties appear only on selection of 'Resequence' option as Sequencer Mode.
...