Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good Python library for AMQP [closed]

Can you recommend what Python library to use for accessing AMQP (RabbitMQ)? From my research pika seems to be the preferred one.

like image 525
Meh Avatar asked Feb 17 '11 16:02

Meh


People also ask

What is Pika Python?

Pika is a Python implementation of the AMQP 0-9-1 protocol for RabbitMQ. This tutorial guides you through installing Pika, declaring a queue, setting up a publisher to send messages to the broker's default exchange, and setting up a consumer to recieve messages from the queue.

Is RabbitMQ a library?

Overview. The RabbitMQ Java client library allows Java and JVM-based applications to connect to and interact with RabbitMQ nodes.


3 Answers

My own research led me to believe that the right library to use would be Kombu, as this is also what Celery (mentioned by @SteveMc) has transitioned to. I am also using RabbitMQ and have used Kombu with the default amqplib backend successfully.

Kombu also supports other transports behind the same API. Useful if you need to replace AMQP or add something like redis to the mix. Haven't tried that though.

Sidenote: Kombu does currently not support the latest pika release (should you rely on it for some reason). Only 5.2.0 is currently supported, this bit me a while back.

like image 171
dgorissen Avatar answered Sep 23 '22 12:09

dgorissen


Pika is the RabbitMQ recommended library, and py-ampqlib is also mentioned. Depending on what you're using Rabbit for, you might also want to look at Celery (a client library dedicated to distributed queuing).

Again, depending on usage, you might also want to look at Apache's qpid which is a full AMPQ-based client-server alternative to RabbitMQ. One thing that attracted us to qpid was that it seemed to have better robustness on server crashes (queues are persisted in a distributed fashion).

like image 23
SteveMc Avatar answered Sep 22 '22 12:09

SteveMc


Having looked at all these libraries, I am now convinced that the right answer is none of them. Instead, build an abstraction layer as a shim over whatever library you choose because you are bound to run into a situation where you have to change libraries.

But do remember, that if you stick to the same version of the AMQP protocol, these libraries do interoperate. Due to different libraries being tested, we had parts of a prototype application running pika, kombu and py-amqplib.

Read this blog about replacing amqplib with pika for a sense of why this is a good idea.

like image 43
Michael Dillon Avatar answered Sep 22 '22 12:09

Michael Dillon