Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
Open
Description
Symfony version(s) affected
7.2.3
Description
dispatching a RunCommandMessage to an async bus like so :
$this->bus->dispatch(new RunCommandMessage('app:do-stuff', false, false));
I would have expected that throwing anUnrecoverableMessageHandlingException
in the command would prevent the messenger from retrying this message, but that does not happen. the exception get wrapped in aRunCommandFailureException
and is retried as per normal config. seems that the RunCommandMessageHandler does not currently provide for any other way to prevent retries.
How to reproduce
dispatch a RunCommandMessage() for a command like :
use Symfony\Component\Console\Attribute\AsCommand;use Symfony\Component\Console\Command\Command;use Symfony\Component\Console\Input\InputArgument;use Symfony\Component\Console\Input\InputInterface;use Symfony\Component\Console\Input\InputOption;use Symfony\Component\Console\Output\OutputInterface;use Symfony\Component\Console\Style\SymfonyStyle;#[AsCommand( name: 'dummy',)]class DummyCommand extends Command{ public function __construct() { parent::__construct(); } protected function execute(InputInterface $input, OutputInterface $output): int { throw new UnrecoverableMessageHandlingException(); }}
to your default bus and see it get retried
Possible Solution
No response
Additional Context
see discussion on slack with@kbond :
https://symfony-devs.slack.com/archives/C9PQ75TV3/p1747312075618569