I need to update the process instance variable(s) of an in-flight (is it considered inflight until the process terminates?) process from another workflow but I am not sure the best way to go about it as I am still new to flowable. The process itself is started via a message start event by a different Workflow process with a businessKey that is derived from a unique property in the process variable.
The two ideas I have are to:
- Add a catching intermediate event to the process definition and then throw a message event signal with the updated properties from the process that needs to update the process instance variables:
void messageEventReceived(String messageName, String executionId, HashMap<String, Object> processVariables);
- Retrieve the process instance through a ProcessInstanceQuery then update the process variables as needed.
Iâm not sure if there is another better way to go about this. I am aware of the following with regards to my two options:
1 - Going this route would mean that every process instance would âwake upâ to catch the eventSignal and would thus have to implement checks so the only the process instance with the right property updates using the provided variables. This could get expensive if there are 100s of this process instances in-flight
2 - Seems a bit more cumbersome than option 1, also Iâm not sure if updating the process variables for the instance will bring it out of the suspend state.
Side note: By the way I think itâd be quite nice to be able to retrieve process instances by businessKeys.