Unable to successfully publish RabbitMQ message to queue using custom name
P粉302484366
P粉302484366 2024-03-26 19:54:35
0
1
481

I want to publish rabbitMQ messages to a queue named "vincent.test.rabbitMq". I'm trying to use Symfony-messenger to do this. This is my message:

class TestMessage
{
    private string $value;

    /**
     * @param string $value
     */
    public function __construct(string $value)
    {
        $this->value = $value;
    }

    /**
     * @return string
     */
    public function getValue(): string
    {
        return $this->value;
    }

    /**
     * @param string $value
     */
    public function setValue(string $value): void
    {
        $this->value = $value;
    }


}

This is my Messenger.yaml:

framework:
    messenger:

        transports:
            vincent.test.rabbitMq: '%env(RABBITMQ_URL)%'

        routing:
            'App\TestRabbitMQ\TestMessage': vincent.test.rabbitMq

But when I post a message like this: $this->bus->dispatch(new TestMessage("testmessage123")); It will create a queue named messages. If I publish under another name

P粉302484366
P粉302484366

reply all(1)
P粉448346289

I found the answer. You just add the queue name to RABBITMQ_URL.

URL = amqp://guest:guest@localhost:5672/"vhost"/"queuename"

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template