Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Messenger][AMQP] Allow to opt out to autosetup delay exchange in configuration #54831

Open
@pierreboissinot

Description

@pierreboissinot

Description

It seems that we cannot configure symfony/messenger to prevent auto setup for delay exchange.

$this->autoSetupExchange = $this->autoSetupDelayExchange = $connectionOptions['auto_setup'] ?? true;

When an application is just a publisher but doesn't consume any queue, there is no need to auto setup a delay exchange.

I'm actually working on a PR about this.

Example

Proposal:
Add the option auto_setup for delay, default true.

framework:
    messenger:
        transports:
            async_transport:
        [...]
       
                # https://symfony.com/doc/current/messenger.html#amqp-transport
                options:
                    delay:
                        auto_setup: false
                    queues: []
[...]

With this option, the delay exchange will not be declared there:

$this->getDelayExchange()->declareExchange();

Also, add a condition in Connection->setup to call setupDelayExchange only if delay exchange is not disabled (transport retry_strategy.max_retries equals 0 ? Not sure because delay may be use in other use cases than retry)

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