Installing RabbitMQ on MacOS
- Download RabbitMQ for Mac here
- Download Java AMQP client library here
- Start RabbitMQ server by running ./rabbitmq-server
- Check that the server is running properly with ./rabbitmqctl status
- Compile and run a HelloWorld testing program from the tutorial here. Compile the Send.java and Recv.java files with javac -cp rabbitmq-client.jar Send.java Recv.java. Run Send.java with java -cp .:commons-io-1.2.jar:commons-cli-1.1.jar:rabbitmq-client.jar Send. This will send the message (in this case the message is “Hello World!”) to the queue. And then run Recv.java with java -cp .:commons-io-1.2.jar:commons-cli-1.1.jar:rabbitmq-client.jar Recv to pop out the message on the queue.
- The server and the queues can also be checked via browser http://localhost:15672/
Now the queue is ready.
Budi Rahardjo 8:20 am on February 28, 2015 Permalink |
On Linux (I know, it’s not Mac OS X 🙂 ) there’s “amqp-tools”. Install it with “apt-get install amqp-tools”. You’ll get five (5) command line tools. For example if you want to publish something:
amqp-publish -e exchange_name -b “your message”
To get a message from a queue:
amqp-get -q queue_name
or
amqp-consume -q queue_name
I believe these tools are built with rabbitmq-c library. Having said that, I looked at the newer version of rabbitmq-c library in here:
http://alanxz.github.io/rabbitmq-c/docs/0.5.0/index.html
It has a number of different tools. Perhaps they changed (upgraded?) the library? I have not looked deeper into it. Basically, it is a C library that you can use to create command line tools. I looked at one of the code, and hardcoded the userid dan password in it so I can use something like this.
amqp_sendstring localhost 5672 amq.direct test “hello world”
I have tested amqp-tools and this rabbitmq-c library agains locally installed rabbitmq server. They work!
Budi Rahardjo 8:37 am on February 28, 2015 Permalink |
And now for some clients. I have tested Perl Net::RabbitMQ. Getting it running is easy.
Publishing message(s) works perfectly, but I am still having problems getting one (1) message from the queue. For some reasons, I got *all* the messages from the queue. ie. get and consume behave the same. I need to tinker some more with the get.
I haven’t had time to play with Python and Java clients.