I am trying to understand what is the right pattern for working with RabbitMQ supplies in the context of a distributed database transaction.
To make this simple, I will illustrate my ideas in pseudo-code, but I actually use Spring AMQP to implement these ideas.
All that like
void foo(message) {
processMessageInDatabaseTransaction(message);
sendMessageToRabbitMQ(message);
}
When we reach sendMessageToRabbitMQ(), I processMessageInDatabaseTransaction()successfully completed our changes to the database, or an exception was thrown before reaching the message sending code.
I know that for sendMessageToRabbitMQ()I can use rabbit transactions or
Perhaps sending messages several times if I cannot confirm the message in my database.
But now I introduced other problems:
/ , 99% .
, .
, , , , , , .., , , , , , .. b ( ), , , . , .
, , , , .
, - ?