0
People like you handle transactions between queues and databases ?
I have a scenario where I must debit (Withdraw money from account) from a customer account and send a message in the queue, but if for some reason the message is not sent (Timeout or anything like that) I need to credit (Put money in account) the amount again in the customer account, I know I can simply do the credit in case of failure, but what if the failure to send to queue actually is an internet failure or something like that does not also make available the connection to the database making it impossible for me to undo the side effect ?
If I have already made the debit in the account and can not credit because there was a failure and my application is isolated from the world what I can do ?
Is there a different way to solve, instead of adding the queue submission method in the middle of my SQL transaction, to be able to do a Rollback if there is such a failure?
I am using Spring Boot 2, Java 8, Rabbitmq and SQL Server 2017.
has already used the
@Transactional
?– Ricardo Pontual
In the case of asynchronous communications such as queues, perhaps a good strategy is to use an Event sourcing
– nullptr
The only problem with @Transactional is that I don’t know if it has this transaction management of two separate objects (DB and Rabbitmq).
– viniciusxyz
Event Sourcing is a great architecture, but I believe that just do not solve the problem.
– viniciusxyz