Reputation: 535
I installed rabbitmq-server and amqp-tools. My consumer starts ok with this parameter:
# amqp-consume -s 127.0.0.1:5672 -e "amq.topic" --vhost "/" -r "worker1" --username=guest --password=guest -d onmessage.sh
Server provided queue name: amq.gen-gzncPpcYr0f1s8HfI-A5cW
My publisher can send the messages and I can see it at the console and web browser:
# amqp-publish -s 127.0.0.1:5672 -e "amq.topic" -r "worker1" --vhost="/" --username=guest --password=guest -b "this is a test message"
# rabbitmqctl list_queuesListing queues ...
amq.gen-gzncPpcYr0f1s8HfI-A5cW 3
...done.
The scrip onmessage.sh just read a line and echo it on screen. But the consumer is not comsuming the messages. Why?
Upvotes: 0
Views: 76
Reputation: 2532
you need to declare a queue in the consumer. you should add:
-q "my_queue"
like this:
# amqp-consume -s 127.0.0.1:5672 -e "amq.topic" -q "my_queue" --vhost "/" -r "worker1" --username=guest --password=guest -d onmessage.sh
the -e declares the exchange.
Upvotes: 1