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

Custom configurations can be made in the Sequencer Configuration Property Sheet (CPS).


Figure 1: Sequencer Component Configuration properties

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 when the sequencer mode is 'Resequence'.


Figure 2: Resequence properties

Resequence Interval

Interval after which resequencing is attempted when the sequencer mode is 'Resequence'.

Initial Sequence Number

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

Sequence Type

The two sequence types for Resequence Sequencer Mode 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.

Data Base Configuration

Click the ellipsis button to configure the required database.

Icon

Refer the Database Configuration section in the DB page for descriptions of database configuration properties.


Figure 3: Database Configuration

Expert Properties

Enable the Expert Properties view to configure these properties.

Icon

Expert properties are meant for advanced users; use with caution.


Figure 4: Expert properties for Generate sequencer mode

Pre Processing XSL Configuration

Pre Processing XSL configuration can be used to transform request message before processing it. Click the ellipses button against the property to configure the properties.

Refer to the Pre/Post Processing XSL Configuration section under the Common Configurations page for details regarding Pre Processing XSL configuration and Post Processing XSL configuration (below).

Post Processing XSL Configuration 

Post Processing XSL configuration can be used to transform the response message before sending it to the output port.

Process Message Based on Property

The property helps components to skip certain messages from processing.

Refer to the Process Message Based On a Property section under the Common Configurations page.

Table Name

Name of the table  to store the messages during execution.

Icon

Default value is a combination of the event process name and the microservice name.

Threadpool Configuration

This property is used when there is a need to process messages in parallel within the component, still maintaining the sequence from the external perspective. 

Icon
  • Limit the usage of the Threadpool Configuration property only in circumstances as mentioned above.
  • If sequential processing is not required, please use sessions on the input port.

Click the Threadpool Configuration ellipsis button to configure the Threadpool Configuration properties.


Figure 5: Threadpool Configuration

Enable Thread Pool

Enable this option to configure the properties that appear as below.

Pool Size

Number of requests to be processed in parallel within the component. Default value is '1'.

Batch Eviction Interval (in ms)

Time in milliseconds after which the threads are evicted in case of inactivity. New threads are created in place of evicted threads when new requests are received. Default value is '1000'.

Sequence Type


Figure 6: Expert properties for Resequence sequencer mode

The two sequence types for Resequence Sequencer Mode are:

  • Continuous: Select this to have two consecutive sequence numbers differ by 1.
  • Non-Continuous: Sequence numbers are not generated continuously.

Functional Demonstration

Scenario 1

The following figure demonstrates a skeleton use case of sequencing. The parallel flows are wrapped between the 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.


Figure 7: Sample flow

Sample Output


Figure 8: Output in the Display window

Useful Tips

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

 

Adaptavist ThemeBuilder EngineAtlassian Confluence