Event Gateway usage efficiently

Hi,
I am new to Camunda and trying to achieve some good design for one of the problem that i have now.
the scenario goes like,

  1. Start the process execution with incoming message
  2. Do the first step in service task (external spring boot and java)
  3. Event gateway waiting for the incoming message for secondStep and thirdStep. Once the secondStep is done. go back to gateway for third step. Once received thirdStep incoming message stop the process.
  4. If the incoming messages are not received in the gateway, write to reporter (external service task) for daily for twice (2days). On 7th day write to reporter (same external service task).
  5. If the messages are not received till 30th day End the process.

Please suggest if I am on right way of doing. Please suggest any better design.

Thanks,
MJPK

You can have possible race conditions with your design: Example: When your second step completes, if the message for the third step comes in before the second step has been completed/transaction has completed, then the message will go unheard.
Same scenario if your timers are executing, and the second or third step messages are sent into the engine, the messages will be ~lost because the process instance is working on the timers and not waiting for the messages.

You want something like this

Those are “Event Sub Processes” Event Subprocess | docs.camunda.org

1 Like

Thanks for quick reply StephenOTT.
if second step is done go for third. There is a possibility of directly coming to third step from external messaging system(second step is completed by them not within the scope of camunda).

Regarding timers, once ‘wrote to reporter’ or log, they will try to reach the event gateway. ‘Going back to gateway and waiting for messages’ - is still the instance alive?

Hi StphenOTT, It is interesting to know the non-interrupting timer events. But how the sub processes trigger the timers? Will have a look into to that area. Thanks anyways.

In my example, yes they are still alive. Check out the docs on Non-Interrupting Timers and how they work (They create parallel executions).

If you want to be able to jump directly from Start to THird Event then i would update the process with something like:

But how the sub processes trigger the timers? Will have a look into to that area. Thanks anyways.

Take a look at the Event Sub Process Docs and the Non-Interrupting Event Docs. They explain that Event Sub Processes are triggered as parallel executions

1 Like

If you might receive the second or third event (and you dont know ahead of time), then you could do something like:

1 Like

Thanks a lot StephenOTT, apt for the scenario.