Python meetup, June 2012: Message brokers & Python | ActiveMQ

Last Wednesday was June's monthly Python Ireland meet-up, this time with a talk by Fernando Ciciliati about message brokers and Python.

After a general  introduction on the advantages and concepts behind messaging, the main part of the talk was about ActiveMQ, a message broker under the Apache umbrella. Fernando explained that this was a broker mostly used by Java people and required a bit of work on their part to get it to play nicely with Python. They had to make significant changes and improvements to the existing libraries.

ActiveMQ is written in Java and designed for high-performance as opposed to reliability, and the default configuration reflects this. If you want your messages to persist after reboot and never be dropped, you will have to tweak the default setup.

The community is very active... which also means lots of bugs! Fernando recommends reading the tracker, as there will certainly be a couple of bugs that are relevant to your situation.

Thanks to the provided binaries, ActiveMQ is easy to install. You get a nice web interface to manage and monitor your queues and messages.

By default, STOMP is not installed and ActiveMQ is only configured to talk to Java via OpenWire. Enabling STOMP support is simply a matter of adding one line to an XML configuration file, and is the easiest way to communicate with Python.

There are several Python libraries available: stomp.py, stompy, Twisted also supports it... They selected stomp.py.

To test your ActiveMQ setup, you can simply telnet into the port and send messages, while using the web interface to see what's happening. The protocol is similar to SMTP.

The terminology used by ActiveMQ differs a bit from other message brokers, be careful when comparing them. (I wonder if this is due to using STOMP vs. using AMQP?). For instance, "topics" seem to be a way to broadcast in ActiveMQ, rather than a way to filter interesting messages.

As usual, the technical talks continued in the pub afterwards :)


Want to receive a weekly digest of new articles?

links

social