conductor icon indicating copy to clipboard operation
conductor copied to clipboard

Wait task and Join Task

Open nicoSalsa opened this issue 9 years ago • 2 comments

Hello, I'm creating workflow using Join and Wait tasks but i don't really understand how it works. Is there any workflow's example using Wait task? When i try, i get Internal Server Error. Concerning "JOIN" task, what i thought is the join task was completed when the differents tasks in the fork are completed but it is not the case. So, i don't really understant the interest of this task. Can you help me? This is an example of my workflow:

[ { "name": "sendMySms", "description": "Simple http flow", "version": 3, "tasks": [ { "name": "fork_join", "taskReferenceName": "forkx", "type": "FORK_JOIN", "forkTasks": [ [ { "startDelay": 0, "name": "wait_status_affected", "taskReferenceName": "wait_status_affected", "type": "WAIT" }, { "name": "send_my_sms", "taskReferenceName": "send_sms", "inputParameters": { "http_request": { "uri": "http://localhost:10200/Notify/NotifySms?phone_number=${workflow.input.phone_number}&message=${workflow.input.message}", "method": "POST", "contentType": "application/x-www-form-urlencoded" } }, "type": "HTTP", "startDelay": 0 } ], [ { "name": "send_my_sms2", "taskReferenceName": "send_sms_2", "inputParameters": { "http_request": { "uri": "http://localhost:10200/Notify/NotifySms?phone_number=${workflow.input.phone_number}&message=${workflow.input.message2}", "method": "POST", "contentType": "application/x-www-form-urlencoded" } }, "type": "HTTP", "startDelay": 0 } ] ], "startDelay": 0 }, { "name": "Claim Affected", "taskReferenceName": "ClaimAffected", "startDelay": 60, "callbackAfterSeconds":10, "type": "JOIN", "joinOn": [ "send_my_sms", "send_my_sms2" ] }, { "name": "send_my_sms3", "taskReferenceName": "send_sms_3", "inputParameters": { "http_request": { "uri": "http://localhost:10200/Notify/NotifyEmail?subject=Info&[email protected]&message=fin", "method": "POST", "contentType": "application/x-www-form-urlencoded" } }, "type": "HTTP", "startDelay": 0 } ], "schemaVersion": 2 } ] Regards,

nicoSalsa avatar Jun 02 '17 13:06 nicoSalsa

A FORK_JOIN task forks a parallel set of tasks. Each set is scheduled to be executed in parallel. But tasks within a set execute serially.

In your case, you have 2 sets of parallel tasks: [wait_status_affected, send_sms] and [send_sms_2]

A WAIT task remains in IN_PROGRESS states until marked as COMPLETED or FAILED by an external trigger (e.g. Swagger).

So, send_sms won't start start until wait_status_affected is marked completed as these 2 will be scheduled serially.

The JOIN task, ClaimAffected waits for [send_my_sms, send_my_sms2]. But they are Task names, not task reference names. The corresponding task reference names are send_sms and send_sms_2.

taskReferenceName is the name which other tasks in the workflow use to refer a task.

The joinOn attribute expects a list of task reference name for which JOIN task will wait for completion. So, change your joinOn to ["send_sms","send_sms_2"]

smkb80 avatar Jun 09 '17 10:06 smkb80

Thanks, it works!

nicoSalsa avatar Jun 12 '17 13:06 nicoSalsa