Hi all,
We are trying to have implement a backend extension that will send out a BPMN signal (i.e. notify subscribers) whenever a given process variable is modified.
The issue we are running into is that, the way we understand it, using an Activiti listener to fire the signal asynchronously means that subscribers may start executing before the new variable value has been committed to the database.
The signal processing could take a while and we don't want failures to interfere with the triggering setVariable, so we send the signal asynchronously. This means that in theory a subscriber could pick up the signal in a different thread, before the triggering setVariable transaction has committed, and read a stale value from the DB.
We have tried using a post commit transaction listener, but we then run into ConcurrentModificationExceptions since runtimeService.signalEventReceivedAsync ends up trying to add a new transaction listener.
In short, is there a reliable pattern to asynchronously signal subscribers about a variable change, while making sure that said subscriber will get the committed updated value when it tries to read it?
Thanks!
Franck