Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Sequencer component is used to Generate a sequence to the messages and send them to output port based on Notification Interval, Resequence Interval and Sequence type. In a Multithreaded environmentretain 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 output flow in the order of their arrival. Sequencer can be used to guarantee the output reaching in the order of their arrival to the output port.

The generation of the sequence could be Continuous and NON-continuous as well.

Configuration

Image Removed  A pair of sequencer components launched in Generate and Resequence modes respectively ensures the order is maintained.

Configuration

Image Added

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 Multithreaded environment.

...

Resequence Interval: Interval after which resequencing is attempted.

Table Name Prefix: Prefix name of the table used for storing sequence number or message to be resequenced. This is used as a parameter to ensure that different processes uses different table. This parameter is appended to the Table Name before creation of table. If two different processes use the same Table Name Prefix indepently, then both the sequences of different processes gets stored in same table. Hence it is advisable to check if there is already a table existing with the same Table Name Prefix

Intial Sequence Number: Number from which sequence starts. By default, it is set to 1.

...

Sequence Numbering on Component Restart: Previous run count will be considered if'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 parallele 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.

Note
  • 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.
Tip
titlePersisting state across restarts

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

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

Functional Demonstration

Scenario 1

Configure component as shown in Figure 1. Using Feeder send input messages and it can be observed that received messages have different Sequence_id generated continuously.

Image Removed

Sample Output

Image RemovedThe 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 and resequencer.

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

Image Added

Sample Output

Image Added

Useful Tips

  • Notification IntervalResequence Interval, and Sequence Type properties appear only on selection of 'RsequenceResequence' option as Sequencer Mode.
  • Sequence Holder Property and Table Name Prefix values cannot be left empty.

 

Adaptavist ThemeBuilder EngineAtlassian Confluence