I am using a python script (3.5.2) and a RabbitMQ worker queue to process data. There is a queue that is filled with user requests of an external system. These user requests will be processed by my python script, each user request results in several output messages. I use the acknoledge functionality to ensure that the incoming message will be deleted only after processing it. This ensures that the message will be reassigned if the worker occasionally dies. But if the worker dies during sending out messages it could be possible that some messages of this user request are already sent to the queue and others wont be sent. Is there a way to send several messages atomically, i. e. sent all messages or none?
Yes, there is - wrap all messages in response to a request as a transaction.
Make message sending to RabbitMQ atomic