Seeking some approaching to handle activities in parallel gateways in SAGA implementation with Kafka

Hi, I am implementing SAGA pattern in Camunda with Kafka. and I am using parallel gateways to send and receive the kafka messages.
for example: i have a Trip workflow and i am using parallel gateways for “Book Flight” ,“book Hotel” and parallelly "Car Reservation " Activity.

  • so when the process started then "Book Flight " and "Car Reservation " run parallelly. if any of activity failes then book flight and car reservation should be rollback and process should be completed. and complete the process. but my receive task is not completed and parallel gateways is also not completed.

Please let me know how can I handle this. i have try this scenario with subprocess and transaction subprocess.
Trip-2.bpmn (24.9 KB)
TransactionDemo.bpmn (15.3 KB)

I am attaching my BPMN file

Hello @gaur.kk ,

please have a look at Transaction Subprocess. This will serve your needs I guess.

https://docs.camunda.org/manual/7.15/reference/bpmn20/subprocesses/transaction-subprocess/

It can use the Cancel End Event to remove all waiting tokens, trigger all compensations and then use an attached boundary event.

Hope this helps

Jonathan

Hi Jonathan,

Thank you for your quick response. i have tried Transaction subprocess, but my problem is same

  • when i complete the Service1 Accomplished with error then all the active tokens are complete and process also completed, and I am good with that.
  • when i complete Service3 Accomplished then Service1 Accomplished and parallel gateways remain active. it is my problem

Please check the screenshot and i am also attaching my workflow.

Please help me to resolve it

Hope you understand
appreciate your help here
Capture2
TransactionDemo.bpmn (17.7 KB)

Thanks,
Krishan

Hello @gaur.kk ,

this behaviour of the parallel gateway is intended. It will wait for Service2 to also be completed and then join the 2 tokens.

One scenario that can happen at the provided state is that Service2 will fail. Then, also the token from the parallel gateway will be removed.

Jonathan

Thanks Jon,

But It is not solving my problem. in my design - if one service get failed then all the services will get rollback in parallel gateways and the token should be remove.

Is there any way we can achieve it in Camunda?

Krishan

Hello @gaur.kk ,

the provided process will do exactly this. After one service fails, every service that has already been executed will be rolled back with the compensation event and all tokens will be removed.

What else should this model provide?

Jonathan

Hi Jon,

no it is not removing all the tokens
see this ===================================

Hi Jonathan,

Thank you for your quick response. i have tried Transaction subprocess, but my problem is same

  • when i complete the Service1 Accomplished with error then all the active tokens are complete and process also completed, and I am good with that.
  • when i complete Service3 Accomplished then Service1 Accomplished and parallel gateways remain active. it is my problem

Please check the screenshot and i am also attaching my workflow.

Please help me to resolve it

Hope you understand
appreciate your help here
Capture2

@Niall any solution for the above situation?

i have a transaction subprocess and inside it there are two Kafka (send and receive) services getting executed parallelly using parallel gateway.

if service1 Accomplished receive a error from kafka then all the services inside transaction subprocess will be rollback and all the open/active token got completed.

but if service3 Accomplished receive a error from kafka then the service1 and parallel gateway are remain active/open. I am not able to figure it out how can i handle this situation. Ideally if any service fails inside the transaction sub-process then all the services will be rollback and process should complete and token should move forward to next step. but in this case it is not happening.

Please advise how to handle this situation.

Thanks,
Krishan