Skip to content

[Messenger] - Allow FailedMessagesRetryCommand to receive a $routableBus instead of a $messageBus #59568

Closed
@racastellanosm

Description

@racastellanosm

Description:

When using the symfony/messenger component with several buses (5-6 buses, each of them with its own transports) is difficult to make the FailedMessagesRetryCommand works correctly since its constructor force the injection of an specific message bus causing that much of the messages can't be retried since they're mapped in another bus.

Proposal

To be able to use the FailedMessagesRetryCommand with several buses, we need to:

  • Replace the MessageBusInterface for a RoutableMessageBus (to allow select the correct message bus inside the command, like the ConsumeMessagesCommand)
  • Add the --bus option on the available definitions to the FailedMessagesRetryCommand
class FailedMessagesRetryCommand extends AbstractFailedMessagesCommand implements SignalableCommandInterface {
...
    public function __construct(
        ...
        private RoutableMessageBus $routableBus,
        ...
    ) {
        ...
    }
...

Then the $routbleBus->getMessageBus($busName) should return the correct message bus to be injected in the Worker constructor where to route the message we want to retry.

PD: I'm using the symfony/messenger component as standalone component outside a symfony application so it would be nice to add this feature

I'm also available to prepare the PR in case the maintainers accept the proposal.

Example

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions