10000 [Messenger] Prioritized Transports example does not work · Issue #11967 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content
[Messenger] Prioritized Transports example does not work #11967
Closed
@ghost

Description

For the Prioritized Transports, the example displayed does not work. I solved it in my code using two different dsn (not sure it is the best pratice).
In the doc, we have :

#.env
MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages

#config/packages/messenger.yaml
framework:
    messenger:
        transports:
            async_priority_high:
                dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
                options:
                    # queue_name is specific to the doctrine transport
                    # try "exchange" for amqp or "group1" for redis
                    queue_name: high
            async_priority_low:
                dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
                options:
                    queue_name: low

        routing:
            'App\Message\SmsNotification':  async_priority_low
            'App\Message\NewUserWelcomeEmail':  async_priority_high

It should be :

#.env
MESSENGER_TRANSPORT_DSN_HIGH=amqp://guest:guest@localhost:5672/%2f/messages_high
MESSENGER_TRANSPORT_DSN_LOW=amqp://guest:guest@localhost:5672/%2f/messages_low

#config/packages/messenger.yaml
framework:
    messenger:
        transports:
            async_priority_high:
                dsn: '%env(MESSENGER_TRANSPORT_DSN_HIGH)%'
                options:
                    # queue_name is specific to the doctrine transport
                    # try "exchange" for amqp or "group1" for redis
                    queue_name: high
            async_priority_low:
                dsn: '%env(MESSENGER_TRANSPORT_DSN_LOW)%'
                options:
                    queue_name: low

        routing:
            'App\Message\SmsNotification':  async_priority_low
            'App\Message\NewUserWelcomeEmail':  async_priority_high

Metadata

Metadata

Assignees

No one assigned

    Labels

    Messengerhelp wantedIssues and PRs which are looking for volunteers to complete them.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0