I have a BPMN which kicks-off with a start event. I have then used an inclusive gateway to invoke two other sub-processes(BusinessTaskRules). Also, I have used an inclusive gateway to wait get the output from both the subprocesses and then proceed. I was able to see the combined end result at the end event. However, I want to send this information to the client who has actually started this process instances. May I know if there is a way to do the same with one single call. Please let me know how to proceed in this use case.
If your client is starting a process instance using the REST API, there is a parameter withVariablesInReturn. This defaults to false, if set to true, then the process instance variables will be returned to the client.
See docs here for reference.
Note - if the process uses async continuations, then this call will return with variables as at the continuation, not after…
Thanks for your reply.
But, yes, since the inclusive gateway and sub-processes are involved, it is async. And i am looking solution for this usecase in-particular.
if your process is asynchronous, then I guess you have two options;
- Your client could register a callback with the process. Hence your process calls the client back with results.
- Or, your process could publish the result to an agreed end point and your client polls the endpoint until the result is available.
Most async patterns will be variations of these two abstractions…
I am bit new to camunda.
I was also thinking in the lines of option2.
Can you please point me to some implementation of Option1 (registering for a callback with the process)?
One easy way is the client supplies the callback URL as a string parameter. Hence this becomes a process variable. Then at the end of the process, have a service task which calls this URL.
You may need to think about authorisation of the callback. One way to do this is the client also supplies a token which could be used as a bearer token to be used in the callback.
Bernd talks to this approach in this blog post…