You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there,
I'm using symfony/messenger and I'd like to have the following behavior for a specific Q:
if the message fails and all the retries fail too ===> the message should be move to a specific queue created specifically for failed messages for further investigations.
However, the behavior I'm getting is the following:
if a message fails, the retries are executed
if all the retries fail too
2.a. my failed message is "sent to the failure transport" based on the logs
2.b. the retries are executed again
2.c if those retries fail too, my message gets discarded
<?phpnamespaceApp\MessageHandler;
useApp\Message\DoATestMessage;
useSymfony\Component\Messenger\Attribute\AsMessageHandler;
#[AsMessageHandler]
finalclass DoATestMessageHandler
{
publicfunction__invoke(DoATestMessage$message): void
{
thrownew \Exception('This is a test exception');
}
}
Here is the command to run my worker ==> bin/console messenger:consume async -vvv
And here is the output
Worker output
> bin/console messenger:consume async -vvv
[OK] Consuming messages from transports "async".
// The worker will automatically exit once it has received a stop signal via the messenger:stop-workers command.
// Quit the worker with CONTROL-C.
[info] Received message App\Message\DoATestMessage
[warning] Error thrown while handling message App\Message\DoATestMessage. Sending for retry #1 using 1000 ms delay. Error: "Handling "App\Message\DoATestMessage" failed: This is a test exception"
[info] Received message App\Message\DoATestMessage
[warning] Error thrown while handling message App\Message\DoATestMessage. Sending for retry #2 using 2000 ms delay. Error: "Handling "App\Message\DoATestMessage" failed: This is a test exception"
[info] Received message App\Message\DoATestMessage
[warning] Error thrown while handling message App\Message\DoATestMessage. Sending for retry #3 using 4000 ms delay. Error: "Handling "App\Message\DoATestMessage" failed: This is a test exception"
[info] Received message App\Message\DoATestMessage
[critical] Error thrown while handling message App\Message\DoATestMessage. Removing from transport after 3 retries. Error: "Handling "App\Message\DoATestMessage" failed: This is a test exception"
[info] Rejected message App\Message\DoATestMessage will be sent to the failure transport Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpTransport.
[info] Received message App\Message\DoATestMessage
[warning] Error thrown while handling message App\Message\DoATestMessage. Sending for retry #1 using 1000 ms delay. Error: "Handling "App\Message\DoATestMessage" failed: This is a test exception"
[info] Received message App\Message\DoATestMessage
[warning] Error thrown while handling message App\Message\DoATestMessage. Sending for retry #2 using 2000 ms delay. Error: "Handling "App\Message\DoATestMessage" failed: This is a test exception"
[info] Received message App\Message\DoATestMessage
[warning] Error thrown while handling message App\Message\DoATestMessage. Sending for retry #3 using 4000 ms delay. Error: "Handling "App\Message\DoATestMessage" failed: This is a test exception"
[info] Received message App\Message\DoATestMessage
[critical] Error thrown while handling message App\Message\DoATestMessage. Removing from transport after 3 retries. Error: "Handling "App\Message\DoATestMessage" failed: This is a test exception"
What am I missing ? Thanks
The text was updated successfully, but these errors were encountered:
Hi there,
I'm using symfony/messenger and I'd like to have the following behavior for a specific Q:
The documentation saving-retrying-failed-messages seems to be explaining exactly what I need.
However, the behavior I'm getting is the following:
2.a. my failed message is "sent to the failure transport" based on the logs
2.b. the retries are executed again
2.c if those retries fail too, my message gets discarded
composer.json
config/packages/messenger.yaml
App\MessageHandler\DoATestMessageHandler
Here is the command to run my worker ==>
bin/console messenger:consume async -vvv
And here is the output
Worker output
What am I missing ? Thanks
The text was updated successfully, but these errors were encountered: