Hello everyone, I would like to ask a question. When using Camunda Platform 7, if I am using an external task, I would like to obtain the final execution result of the entire process to determine whether it has been successfully completed. How can I obtain the final execution result of the process? I hope someone can help me answer. Thank you very much.
Hi @gaozhendong what you are trying to do, can be accomplished but requires some clarification.
First, let me explain why External Tasks are not as good candidate for your use case:
-
External tasks are a very specialized type of task, a task is a single step in a process, the external tasks delegate the execution of code to a third system in the scope of this single process step, so they are better at the scope of the step. When an external task finishes with its code, it does not know anything about the next step.
-
External tasks need an active process, there is no chance to call an external task if a process has been completed, because as mentioned before, the external task lives in the context of a process step.
I suppose you want to programmatically check if a process instance is finished. So here couple of ideas:
-
Use an execution listener on the end event. This is part of the delegation code, based on your requirement, not sure if this for you, but check it so you know the idea Delegation Code | docs.camunda.org
-
If delegation code is not for you, use an end event of type message to send a message to a system that needs to get notified about the process instance being terminated. The sending message implementation can be done with an external task, see Message Events | docs.camunda.org. Which is what you wanted, but the fine part missing is, if you do this, your process is AT the end, but not ended. You need to check how the execution of a symbol works, see the first image in this link Transactions in Processes | docs.camunda.org
-
Wrap your process with a parent process, more precise like call activities, the parent process can have some activities that read variables from the finished instances, so building an actual observer pattern with BPMN.
Cheers,
Gerardo