Orchestrate User Task

This handler (com.rierino.handler.TaskEventHandler) provides ability to include human actions and time delays in API calls.

Handler Parameters

Parameter
Definition
Example
Default

task.action

Action to apply on process records on proceed (delete or update)

delete

update

role.domain

State manager for storing role process data

workflow_product

workflow

role.idPath

Json path for process id field in role data

id

processId

role.enrichPath

Json path of role data for enriching process data on proceed

data

-

role.fromTimePath

Json path of role data to be used as 'from time' in timeout calls

fromDT

fromTime

role.toTimePath

Json path of role data to be used as 'to time' in timeout calls

toDT

toTime

timer.onFail

Action to apply if timeout timer fails to process

DLQ

Default action fail

timer.dlq.stream

Name of the DLQ stream if timer fails with DLQ strategy

timer_fail

-

timeout.states

Comma separated list of process states which will be monitored for timeouts

workflow,workflow_product

-

timeoutBuffer

Buffer size for processing timeouts

100

-

timerMs

Milliseconds between each timeout calculations

60000

2000

Example Task Handler Definition (Can be Imported on Element Screen)

Actions

StartTask

Records current event as a process entry to proceed after a trigger or timeout after given time. Event metadata fields applicable for this action are as follows:

Field
Definition
Example
Default

domain

Name of the state manager to store process data in

workflow

-

inputElement

Json path for storing data to return on proceeding process

process.data

-

With event metadata parameters as:

Parameter
Definition
Example
Default

inputPattern

JMESPath pattern to apply on data input

{data: process.data}

-

taskIdPath

process.id

taskId

taskName

Descriptive name for the task

Job Post Approval

-

taskSpec

Task specification (i.e. reference name for the process flow)

job_post_approval

-

taskAction

Referential name of the action

Approve

-

timeout

Milliseconds to timeout started process after

60000

-

timeoutOn

Epoch time in ms to timeout started process on

1666765654

-

Example

Input

{
    "parameters": {
        "productId": "product-1",
        "brief": "Image and video creation with summer vibes" 
    }
}

Event Metadata

StartTask action can be followed with an event status condition step in sagas, for escalation of tasks not completed in timeout duration. The "TIMEOUT" condition value can be used for such flows.

ProceedTask

Triggers proceeding of an existing process entry, enriching with stored event data. Event metadata fields applicable for this action are as follows:

Field
Definition
Example
Default

domain

Name of the state manager keeping process data

workflow

-

inputElement

Json path for the input in request event payload

parameters

-

outputElement

Json path for the output in response event payload

process

-

With event metadata parameters as:

Parameter
Definition
Example
Default

inputPattern

JMESPath pattern to apply on data input

{data: newData}

-

outputPattern

JMESPath pattern to apply on enrich data output, before returning response

{stored: oldData}

-

taskIdPath

Json path which defines id for proceeding the process

id

[requestId]:[sagaStepId][runnerPartition]

enrichPath

Json path to use for enriching proceeded process event data

newData

-

Typically a global, generic /ProceedTask endpoint is used for triggering progression of tasks assigned to users across all sagas.

However, it is typically preferred to have the ProceedTask action running on the same runner performing StartTask sagas, as they typically need to have access to the same state managers (e.g. approval states).

TimeoutTask

Triggers timeout of an already started process, enriching with input event data. Event metadata fields applicable for this action are as follows:

Field
Definition
Example
Default

domain

Name of the state manager keeping process data

workflow

-

inputElement

Json path for the input in request event payload

parameters

-

outputElement

Json path for the output in response event payload

process

-

With event metadata parameters as:

Parameter
Definition
Example
Default

inputPattern

JMESPath pattern to apply on data input

{data: newData}

-

outputPattern

JMESPath pattern to apply on enrich data output, before returning response

{stored: oldData}

-

taskIdPath

Json path which defines id for timed out process

id

[requestId]:[sagaStepId][runnerPartition]

enrichPath

Json path to use for enriching timed out process event data

newData

-

TimeoutBetween

Triggers timeout of all processes with timeout time within the given range. Event metadata fields applicable for this action are as follows:

Field
Definition
Example
Default

inputElement

Json path for the input in request event payload

parameters

-

With event metadata parameters as:

Parameter
Definition
Example
Default

fromTimePath

Json path for "from time" of timeouts

start

Last timeout

toTimePath

Json path for "to time" of timeouts (updates last timeout)

end

-

Roles

proceedTask

Triggers proceeding of an already started process with the id defined in idPath of role data in role domain, enriching with enrichPath data.

timeoutTask

Triggers timeout of an already started process with the id defined in idPath of role data in role domain.

timeoutBetween

Triggers timeout of all processes in role domain with timeout time between values given in fromTimePath and toTimePath of role data.

Commands

TIMEOUT

Triggers timeout of all processes with timeout time within the given "fromTime" and "toTime" range.

Task Record

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

Field
Definition
Example

id

Unique task id

123

isProcessed

false

timeout

Epoch time of the timeout for current task

1686154822136

data.event

ask

{...}

data.taskId

Unique task id

123

data.taskName

Descriptive task name

Product Approval

data.taskAction

Descriptive task action

Approval

data.taskSpec

Reference to the task data specification

product_approval_ui

data.input

{}

Last updated