Skip to content

[Messenger] Ability to dispatch retryEnvelope to another bus #31848

@proArtex

Description

@proArtex

I have separate buses like this:

# messenger.yaml

framework:
    messenger:
        default_bus: my.sender
        buses:
            my.sender:
                default_middleware: false
                middleware:
                    - messenger.middleware.send_message
            my.receiver:
                default_middleware: false
                middleware:
                    - App\Middleware\MyMiddleware
        transports:
            async:
                dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
                retry_strategy:
                    max_retries: 999
                    delay: 10000
                    multiplier: 1
                    max_delay: 0
        routing:
             '*': async

I use command bin/console messenger:consume async --bus=my.receiver.

So we have a retryEnvelope dispatch call that goes directly to the same receiver bus. Variable $bus comes from ConsumeMessagesCommand:

# ConsumeMessagesCommand.php
$bus = $this->busLocator->get($input->getOption('bus'));

# Worker.php
$this->bus->dispatch($retryEnvelope);

Since I have different buses (I strongly believe that one bus per send/receive ops is kind of workaround with "ifs"), I need an ability to somehow point to another bus. Is there any solution coming? Did I miss something?

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