Contents

Sequencer component is used to retain the sequence of messages when a certain section of the flow has to be processed in multiple flows for performance concerns. When messages are split into parallel flows, 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.

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 is chosen, else the run count is started from initial Sequence Number set in the CPS.

Number of Parallel Flows

The number of 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.

Icon
  • Notification IntervalResequence Interval, and Sequence Type are not applicable for Generate Sequencer Mode.
  • DB table is only used for storing the sequence number to be generated/validated.

Persisting state across restarts

Icon

For the solution to work even when components are restarted, the following changes have to be made.

  • Use CLIENT_ACKNOWLEDGE mode on the input port of the Sequencer component launched in resequence mode. This ensures any out of sequence messages received by the component will be pushed back to the input port when the component is stopped.
  • Use the Continue from previous run option in both generate sequence and resequence mode. This makes sure the sequence number is retrieved from DB.

Functional Demonstration

Scenario 1

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 sequencer and resequencer.

Filters are appropriately set on routes so that each parallel flow receives the corresponding message.

Sample Output

Useful Tips

  • Notification IntervalResequence Interval, and Sequence Type properties appear only on selection of 'Resequence' option as Sequencer Mode.

 

Adaptavist ThemeBuilder EngineAtlassian Confluence