Asko Soukka and Jukka Ojaniemi - Plone, RabbitMQ and messaging that just works

published Oct 10, 2012, last modified Oct 14, 2012

Talk during the Plone Conference 2012.

Asko Soukka and Jukka Ojaniemi talk about Plone, RabbitMQ and messaging that just works, during the Plone conference 2012.

Why message queues? We needed to run asynchronous tasks. Difficult to do well within the ZODB, once you are talking about a decent amount of requests. So we use something external.

AMQP is like a postbox: Advanced Message Queue Protocol.

  • A message consists of a label and payload.
  • Producer is a program which sends messages to exchange.
  • Consumer is a program which waits to receive the messages.
  • Exchange sits between producer and consumer
  • Bindings are routes from exchange to a queue.
  • Queues store messages.

You can build several messaging systems, like publication/subscription and RPC (client to server and then back to client).

RabbitMQ implements AMQP. Written in Erlang. Industry tested and reliable.

Sounds difficult? Well, messaging in Plone can be easy.

Example with collective.zamqp for publish and subscribe announcement. Get a utility, register a producer and publish a message in basically three lines. Handling incoming messages: register an event handler for IMessageArrivedEvent.

Beaker comes with an asynchronous connection utility. Zope uses a similar technique under the hood, which handles transactions for us. To use collective.zamqp you need to define some additional zope configuration in your buildout.

Code and demos:

Other relevant links:

Slides of this talk: