Hi team,
I am new to temporal. I am trying to simulate a workflow in temporal which was modelled using a BPMN tool and have following queries:
How do I set variable values in a workflow process instance in Temporal, and how can the parent process instance access the variables set at the child process level?
What is the recommended approach for creating a multi-instance subprocess or activity in Temporal?
Many BPMN tools offer DMN (Decision Model and Notation) support for decision evaluation. How can I achieve similar decision evaluation capabilities in Temporal workflows?
Expecting your response for the same. thanks in advance
The exact syntax depends on the programming language used. There is nothing special about variables in Temporal, they are just normal variables. They can be local function variables, instance level variables, and even global variables (with some caveats).
how can the parent process instance access the variables set at the child process level?
Using global variables shared across multiple parts of the application is an anti-pattern that Temporal doesn’t support. When a child workflow is invoked it receives input arguments and when it completes it returns output arguments.
Temporal supports full power of programming languages. So in many cases when BPMN uses subprocesses a single Temporal workflow that models logic using OO or functional decomposition approach is needed.
Many BPMN tools offer DMN (Decision Model and Notation) support for decision evaluation. How can I achieve similar decision evaluation capabilities in Temporal workflows?
Temporal doesn’t directly support DMN. You can always integrate an existing DMN tool into your workflows. But it is not really needed as programs in high level programming languages are much more friendly for developers.
Thanks for the response. I am working on temporal Java. Could you please guide me on how to achieve multi instance subprocess? I have a use case to simulate multi instance parallel and sequential subprocesses based on the user input. For eg, suppose a user selects a country filed, based on the country I need to trigger multiple approval subprocess in parallel. The instances required for the subprocess change dynamically based on input country field. How can I achieve the same using temporal.
Java doesn’t have the concept of a subprocess. So you invoke each of them in its own thread. Something like:
Promise<Void> p1 = Workflow.newPromise(null);
if (needs1) {
p1 = Async.procedure(()->process1(p1args));
}
Promise<Void> p2 = Workflow.newPromise(null);
if (needs2) {
p2 = Async.procedure(()->process1(p2args));
}
// Wait for both p1 and p2 to become ready
Promise.allOf(p1, p2).get();