[openstack-dev] [Mistral] callback on workflow completion

Dmitri Zimine dzimine at stackstorm.com
Wed Sep 17 17:36:10 UTC 2014


Use case: 
The client software fires the workflow execution and needs to be know when the workflow is complete. There is no good pool strategy as workflow can take arbitrary time from ms to days. Callback notification is needed. 

Solution is a webhook

Option 1: pass callback URL as part of starting workflow execution:
POST /executions
    workflow_name=flow
    callback= {
        events: [[on-task-complete, on-execution-complete]
        url: http://bla.com
        method:POST
        headers: {}
        … other stuff to form proper HTTP call, like API tokens, etc ...
    }
    …..


Option 2: webhook endpoint
Mistral exposes /webhook controller 
Client creates a webhook and receives events for all executions for selected workflows. 
{  
  "name": "web",
  "active": true,
  "events": [  ]
  “workflows”: [wf1, wf2] 
  "url": "http://example.com/webhook",  
}

Opinions: 

DZ: my opinion: 
Option 1 for it is simple and convenient for a client. 
It seems like an optimal solution for “tracking executions and tasks” use case.

Option 2 is an overkill: makes it harder for a client (post workflow, post webhook, post execution, delete workflow, delete webhook) introduces lifecycle management problems (e.g., workflow deleted -> webhook orphaned).

I vaguely recall someone from Heat compared these options and regretted one of them for security reasons, but can’t remember details.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140917/03b8a598/attachment.html>


More information about the OpenStack-dev mailing list