Closed
Description
Sometimes a worker handles a message that fails with an error that is hard to recover from. For example, if Doctrine encounters an error at the database level, the Entity Manager will be closed and it is difficult to reset Doctrine to a clean state. By default, all following messages will fail when they try to use the same Entity Manager.
I think it would be a good idea to add an option to the messenger:consume
command, which will stop the current worker after a message failed (and the message was potentially dispatched again for a retry). A tool like supervisor
could then be used to start a new worker with a clean environment.