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粉4483462892024-03-27 17:23:03
I found the answer. You just add the queue name to RABBITMQ_URL.
URL = amqp://guest:guest@localhost:5672/"vhost"/"queuename"