Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Messenger] messenger:consume command does not use the fallback bus #31741

Copy link
Copy link
Closed
@jakzal

Description

@jakzal
Issue body actions

Symfony version(s) affected: <=4.3.0

Description

Messages coming from non-symfony producers are rejected by the messenger:consume command:

2019-05-30T16:12:46+00:00 [warning] Message will not be retried because the SentStamp is missing and so the target sender cannot be determined.
2019-05-30T16:12:46+00:00 [critical] Rejecting App\Message\Foo  (removing from transport).

The error is a result of the Symfony\Component\Messenger\Exception\InvalidArgumentException thrown by RoutableMessageBus:

Envelope is missing a BusNameStamp and no fallback message bus is configured on RoutableMessageBus.

My expectation was the message would be routed to the fallback message bus.

How to reproduce

Publish a message outside of Symfony (i.e. from another system, or directly with RabbitMQ admin interface).

Run the messenger:consume command without specifying the --bus option.

Possible Solution

Either pass the routable message bus which is already registered on the service container, or pass the default message bus to the routable message bus that's created in the ConsumeMessagesCommand.

Additional context

The routable message bus is created directly by the ConsumeMessagesCommand:

if (null !== $input->getOption('bus')) {
$bus = $this->busLocator->get($input->getOption('bus'));
} else {
$bus = new RoutableMessageBus($this->busLocator);
}

It's inconsistent with the way the message bus is registered on the container:

<!-- routable message bus -->
<service id="messenger.routable_message_bus" class="Symfony\Component\Messenger\RoutableMessageBus">
<argument /> <!-- Message bus locator -->
<argument type="service" id="messenger.default_bus" />
</service>

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.