Distributed transactions commit / roll back in parallel gateway

Hello, I have an interesting problem to solve. Imagine a large chain store system where a customer receives a certain number of points for each purchase, corresponding to the amount spent. At any time, he can exchange the points he has collected for vouchers of the corresponding value, which he can then use as payment at the checkout. Let’s now focus on the part of the process where we need to reduce points in one system and allocate a voucher in another at the same time. This is so that both transactions will take place if everything is error free but that both transactions will be cancelled if an error occurs in one of the operations. This means that if we deduct points then if the second transaction fails and the voucher is not allocated the deduction of points is cancelled. So far I have no idea how to do this using the BPMN process on two independent systems: the VUCHER system and POINTS system.

Thank you very much for any help

pgwc.bpmn (5.9 KB)

So you want an ACID transaction that spans both systems? If the systems support XA protocol then this is not a problem if you don’t use async points in the fork. Then everything is executed in one thread so that you can use the XA protocol.

But usually, such “distributed updates” are not implemented via ACID transcations but instead with compensations. I.e. each update is performed, technically speaking, in its own transaction, and the process executed compensating actions if not everything went OK. This might make the process model quite big and complicated, but the life is not easy as well…

3 Likes

Hi,
Compensations are good choice. You can use transaction subprocess to achieve that. Take a look at Transaction Subprocess | docs.camunda.org

1 Like

@fml2 Thank you in advance it helped to me

1 Like

@shamil big thanks to you

1 Like