Perform some action when variables of a process change

I want to update an index of elastic search when a variable of my process changes. The current implementation is done with a Spring Event Listener, this does the update on every event that occurs.
The result of this is, that the index gets updated even when nothing has changed.
I know that Camunda doesn’t support this feature out of the box, maybe you could help me with that concern.

Possible solutions that came to my mind were the following:

  • Use a custom spring event listener
  • Implement a general dataholding model, in every change of it, push the changes to elastic search
  • React in every delegate, in which a change could happen (compare old and new variable map of delegate execution)
  • Implement a event listener which fires at the end of a Task, that should have made some changes to the variables
  • Function which is used instead of the setValue on the Delegate which is getting the old value comparing it with the new one and if it is new set it and then update the ES index
  • For every event, read the old information of the process out of the Camunda DB and compare it with the new one
  • Create a seperate data store, in which all for elastic search relevant data gets stored (for each process)
  • Make a queue for requests to elastic search, in which duplicates are deleted

Why can’t you just stream the data only when an event type and the variable changes met the filter criteria?

If you decide to handle this in the process model, have you considered an event sub process with a conditional event as start event? You could use the update of the variable(s) to re-evaluate the condition of firing the event. See Conditional Events | docs.camunda.org for more information.