Context:
With OPT-3054 and OPT-3015 we made use of having flowNodeInstanceUpdate records populated for adjacent flowNodeInstances that may lack an own end or start mapping.
As these updates are merged into flowNodeInstances (stored in `events`) we however loose track of the original event that created the update.
This is a problem in two cases:
- idempotence, the same event being processed repeatily should not create a different state, but without tracking which event was applied we don't know if the event triggered update is actually new or not
- update of existing events, if a particular event is reingested with e.g. a different timestamp that would get correctly reflected in the flowNodeInstance it is mapped to explicilty, however it's updates would not get applied as adjacent flowNodeInstances already have their corresponding end/startDate set from the previous event instance
In order to resolve that we should keep track of WHICH event was correlated as WHAT to a particular flowNodeInstance.
This could look like:
correlatedEvents: [{id:'122', mappedAs: 'START'},{id:'321', mappedAs: 'END'}]
Whenever we would reprocess or update one of these events we could merge the change into all existing flowNodeInstances with the particular eventId in their correlatedEvents array. We would also need to add/remove/amend any connecting gateways between events that had already been created.
AT:
- events processing/Event Process Instance import is fully idempotent