As of right now, for the most part, the workflow of the process is going as it should. However, sometimes, we receive the callback for message correlation from an external service too fast (for example, we receive success2 message event while we are still working on task1), before the process waits on the Gateway for any messages, thus leading to message Correlation Exceptions.
Are there any good practices that could ensure correct behavior in this scenario?
Some of the possible solutions I have saw were involving either conditional events or event subprocesses.
This is actually a pretty common problem when you’re dealing with systems that return quickly - there are a few different options - but the easiest one is to implement the principal of waiting for the response before sending the message. That can be done like this:
The important part is to make sure that the Send Message to System task is marked asynchronous before which will ensure that it waits for a response before sending the message.
This is clear enough. It’s the typical solution for request-callback integration pattern and external tasks solve this problem even better.
But how to deal with the same problem with publish-subscriber integration. When there are a number of events in respond and process should handle them one-by-one (in current example task2 should be started only after success2 received and after task1 is finished).
But success2 event can occur while process handle task1 and engine in this situation just miss this event and stuck on the second event-based gateway.
I think it should be a typical kind of process but I can’t find kind of “best practise” solution for such problem.