phpsymfonyrabbitmqsymfony-messenger

Can't publish RabbitMQ message to queue with own name


I would like to publish a rabbitMQ message to a queue with this name: "vincent.test.rabbitMq". Im trying to do that with the Symfony-messenger. 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;
    }


}

And this is my messenger.yaml:

framework:
    messenger:

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

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

But when I publish a Message like this: $this->bus->dispatch(new TestMessage("testmessage123")); It will create a Queue named messages. If I publish another Message with another name It will also go into this Queue. What I want is a seperate Queue for every Message. enter image description here


Solution

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

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