May 3, 2019 Javier Eguiluz

The Messenger component provides a retry mechanism for messages. In Symfony 4.3 we've improved this feature to add a "failure" transport, so that messages that fail on all their retries can be collected in one spot and retried later if wanted.

Consider the following configuration:

1 2 3 4 5 6 7 8 9 10 11 12 framework : messenger : failure_transport : failed transports : async : dsn : 'amqp://' failed : dsn : 'doctrine://default?queue_name=failed' routing : 'App\Message\SmsNotification' : async

In this setup, SmsNotification would be retried three times on the async transport and then finally sent to the failed transport. You can consume the failed transport like a normal transport, but you should handle and consume it by one of these new commands:

1 2 3 4 5 6 7 8 9 10 11 12 13 $ php bin/console messenger:failed:show There are 3 messages waiting in the failed transport. --- --------------------------- ------------------- ----- Id Class Failed at Error --- --------------------------- ------------------- ----- 217 App\Message\SmsNotification 2019-04-10 22:12:01 ... 218 App\Message\SmsNotification 2019-04-10 22:12:00 ... 219 App\Message\SmsNotification 2019-04-10 22:11:59 ... --- --------------------------- ------------------- ----- // Run "messenger:failed:show {id} -vv" to see message details