Synchronous release of AMQP

I know that there are many libraries that implement AMQP support in python. However, I need a library that will allow me to publish AMQP in a synchronous style, because it will be used from a WSGI application, so the usual asynchronous style of interacting with a queue broker should be bit out of place there.

Other parts of the system use pika to support AMQP, but it is asynchronous, and I would prefer not to use it, even if there is a kind of โ€œblockingโ€ connection there.

Of course, if all else fails, you can maintain a Pika event loop for the WSGI process. Another problem is that I found a couple of nasty (IMO) errors in the current stable version of Pika, and I would rather use something else.

Repeat:

  • I need to do basic.publish (with support for โ€œconfirmโ€ so that I know when the message is not really published)
  • Synchronously
  • To rabbitmq (obviously, pure AMQP can also work)
  • In a WSGI application for python
+4
source share
3 answers

I understand that you can use RabbitMQ RPC for a synchronous call. Since you already have a peak, you donโ€™t have to make much effort.

+1
source

I would recommend you check out Kombu , which is the base library used by Celery . Both Kombu and Celery usually and easily integrate with Django and Flask (which is based on Werkzeug), so you should have no problem integrating it with your WSGI application.

+1
source

Have you checked the example code on the pika documentation site?

There is a section: Synchronous programming style, concurrency http://pika.github.com/communicating.html#synchronous-programming-style-no-concurrency

It looks like you want it a kind of RPC style challenge. You can find a good synchronous example: http://www.rabbitmq.com/tutorials/tutorial-six-python.html

0
source

All Articles