-
Notifications
You must be signed in to change notification settings - Fork 605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Awaitable Workflow outcomes #2896
Comments
I can add some thoughts of a discussion a while back. I see the following alternatives. I personally tend to favor approach number 2 – as I think it is the best compromise of decoupling of the Code and the Model but also really powerful. 1. Wait for a certain activity, via API So you can say something like (naming tbd):
Advantage: different clients could wait for different Activities – and you don’t have to change the model at all for this. We could even later on provide
2. Wait for some data condition to be true, via API
Advantage: You are completely decoupled from the BPMN workflow model and just wait e.g. for some data to be set. 3. Add some element in the BPMN model to trigger the response
Advantage: You can see it in the model graphically (but nobody stops you adding a noop element in your BPMN in alternative 1 or 2 if you need a visual clue). 4. Add some attribute to elements of the BPMN model to trigger the response Advantage: You could configure the end event to trigger the response |
Use Zeebe workflows in REST request/response operations in the sync wayUse Case
or with HTTP header ie.
APIUpdate msg CreateWorkflowInstanceRequest (add field workflowInstanceCorrelationId)
Add new service: GetWorkflowInstanceStatus
ORAdd new service: GetWorkflowInstanceStatus (Stream Response)
Solution using MQTTThis could be done using MQTT server (correlate msgs), without access to history:
or with HTTP header ie.
CommentsNaming convention could be misleading, I'm new to Zeebe, gRPC and BPMN. According to @berndruecker proposals, the last one (4) seems to me to be the simplest solution to make REST request/response keep sync. Modified 08.03 |
We would probably need both, ideally. We cannot keep completed workflow state indefinitely in the broker, otherwise disk / memory usage and performance will be impacted. So we need to emit completion when it happens as a one-time event. And a workflow may raise an incident - in which case no completion is emitted - and you may want to let the requestor know; or update them on "30% complete" or similar as it progresses. In this case a query API like However, such an API introduces a tight-coupling if it requires knowledge of the internal structure of the workflow. All it takes is for an updated workflow to be deployed with a renamed flow node, and your application code breaks. I think the lowest-orbit solution would be the ability to subscribe to the end event and get the final variable state. Then some emitter node would reduce / make explicit the coupling between the workflow and application code. |
It's for current state purpose not for history, the solution could be to add "ttl" (time to live after workflow instance finished) field to the CreateWorkflowInstanceRequest msg. |
Now I'm thinking about new service like GetWorkflowCurrentStatus - it's something I think what @berndruecker propose in the first and second point
The problem with this service is that the client will not get status of workflow instance when disconnected ie. for timeout reason or something. |
Do you guys had a look at the Hazelcast exporter? https://github.com/zeebe-io/zeebe-hazelcast-exporter You have to register the exporter in the broker, embed the connector in your application and then get notified for specific events. |
Just to make sure: The feature request scope is to make this possible without any additional 3rd party software you need to operate. I see Hazelcast as a possible workaround for the moment though. |
Can you set ETA for this feature? |
Would love to see this feature happening! But I'd state that it's very reasonable to not want to know the workflow had ended, but rather reached a specific step. This way part of the flow is "online" and part of offline. |
Waiting for this to happen. |
Can we have this feature? I could be really awesome!! |
I will be glad to get this feature! |
Any thoughts on #3048 I think it's basically a duplicate of #2896 (comment). I think it would be great if you could have a client subscribe to a message. It opens up a whole other way of usage and allows easy response that is clear and concise in the Bpmn |
this feature for c#, would be nice |
I was surprised that this feature doesn't exist. I have a use case where a user uploads a file through an OpenFaas serverless handler. This schedules a workflow of parsing the file which may take a while. While the user is waiting in the frontend, I would like to update the view with the status of the workflow (progressbar or steps). I expected this to be possible by having the serverless handle open a websocket connection with the client, passing through all events it would receive from the workflow. Is this possible? Edit: found my use case in the blog post: https://github.com/jwulf/zeebe-affinity-service |
See also: #2916 (comment) |
@Tails as a workaround you can generate UUID for every request and attach it to HTTP header ie. "requestId" and pass it through tasks and handlers. Then you can use "requestId" as MQTT topic name and subscribe to it to get status information which you will send from OpenFAAS functions (publish to the defined topic name). You can use MQTT over web sockets if you wish. |
Based on the inspiration of the blog post and the example repository this was indeed the idea I got. The OpenFaas handler returns a topic ID for the JS client to listen to. After the workflow invocation using the short-lived serverless handle the JS client opens a connection with a websocket server that, as a worker "spy", listens to workflow progress events and publishes these over the websocket to the frontend view. Thank you! |
Can we get some more details on what that PR does? What is a completed workflow in this context? End event? Wait state? (Like wait for a message). Will this be added for the correlate a message "with result"? |
@StephenOTT A workflow instance is completed when there is nothing more to be processed related to the workflow. That means the end events are completed. To be more precise, the "process" element has reached |
Okay. Can a client reconnect for a waiting of a process to complete or if the client loses its connection, it can never retrieve the result? This feature was designed for short lived processes? |
Amazing work guys! Any idea when will this be available for the nodejs library? |
Very cool, such a quick response! Workflows are often invoked from short-lived (REST/serverless) handlers. Can the workflow result be retrieved asynchronously; from another handler? And can the result be queried indefinitely or only in a certain window of time? (until historic event log is purged?) |
At the moment it is not possible to retrieve the results asynchronously. Reason is that all state related to the workflow is deleted when it is completed. Currently this feature is addressed towards short lived processes. TBD if we implement asynchronous query. |
If you could implement the ability for a client to await a BPMN message then you would not need to, you can have a client await for that message. |
As soon as it drops in an alpha build. |
It depends what you mean by short-lived, but yeah, you are not going to wait for days, because if you lose the gRPC connection you lose everything. You don't even have a workflow instance id to find the outcome in an exporter. |
3242: feat(clients/java): get workflow outcome r=deepthidevaki a=deepthidevaki ## Description * create a workflow instance and get the results (set of variables) when the workflow is completed. ## Related issues <!-- Which issues are closed by this PR or are related --> Related to #2896 closes #3227 # Co-authored-by: Deepthi Devaki Akkoorath <deepthidevaki@gmail.com>
Is your feature request related to a problem? Please describe.
At the moment it is not possible to start a workflow and be notified of the outcome.
Describe the solution you'd like
In the client libs, some way to await the outcome of a workflow.
Describe alternatives you've considered
https://zeebe.io/blog/2019/08/zeebe-rest-affinity/
The text was updated successfully, but these errors were encountered: