Merge Parallel Steps

This handler (com.rierino.handler.MergeEventHandler) provides ability to merge parallel saga steps in distributed flow executions.

Handler Parameters

Parameter
Definition
Example
Default

merge.locker

Fully qualified class name for the locker to use for thread safety.

com.rierino.state.lock.RedisStateLocker

-

merge.action

Whether merge completion should delete, update or ignore state record

delete

update

MergeEventHandler also supports timer and timeout parameters as in TaskEventHandler.

Actions

Merge

Merges multiple parallel running branches in a saga flow, storing merge status in a state manager. Each merge instance is identified by a unique taskId, and contributing branches are identified by their mergeIds. When all required merge ids are received, the merge step continues.

Field
Definition
Example
Default

domain

Name of state manager for coordinating merge state

search_merge

-

With event metadata parameters as:

Parameter
Definition
Example
Default

mergePath

results

-

requiredMergeIds

Comma separated list of merge ids that are required to complete the merge

1,2,3

-

mergeIdPath

Json path which defines id for merge branch

id

mergeId

taskIdPath

mainId

taskId

Merge handler also allows timing out merge tasks, in case some branches do not send their results in time. For this purpose, all timeout roles and commands of the TaskEventHandler are also supported.

Merge Record

Current state of a merge activity is stored in the state manager with the following details:

Field
Definition
Example

id

Unique merge id

123

data.event

{...}

data.requiredMergeIds

Comma separated list of mergeids required to complete the operation

1,2,3

data.waitingMergePaths

Array of mergeids still waiting to be completed

[1,3]

data.mergeElements

Current contents of the merge elements

{...}

data.timeout

Epoch time of the timeout for current operation

1686154822136

data.isProcessed

false

In case of local saga flows, steps are executed in sequence, so ForEachEventHandler should be used for creating parallelism instead of MergeEventHandler.

Last updated