I made an interesting observation today, which seems like a race condition when triggering an SRG from a workflow.
I have this situation:
- A workflow is triggered upon a bizevent. The bizevent contains some information in a JSON payload
- the workflow then triggers a SRG, with objectives that query the exact same bizevent to perform analysis on the payload.
- I have noticed that sometimes when the SRG executes the query for the bizevent the data seems to be not there yet? e.g. the DQL in the obejctive would get the last Bizevent of that type. Querying that bizevent in the objective with:
| sort timestamp desc
| limit 1
should give us the exact last injected BizEvent. But it sometimes isn’t…it’s the previous one.
I have tested this by adding a time delay on the workflow, to have it wait 30s between the trigger and the SRG execution. Then this works.
So could it really be that the WF triggers are executed directly upon ingest before the bizevent is actually persisted so it can be queried by DQL?