Search code examples
pythonpython-3.xrabbitmqgeventpika

Pika and gevent - compatibility


is Pika compatible with gevent?

Monkey patching provided with gevent patch standard socket library - is this enough for valid switching pika with gevent?

Best regards, Matt.


Solution

  • Monkey-patching pika using gevent should work fine, but it isn't officially supported.

    Keep in mind that that pika is not thread-safe, and using gevent won't change that. You still need one pika connection per thread.

    There are a couple of threads discussing the usage of gevent and pika on github that might be worth reading through. https://github.com/pika/pika/issues/102

    There is also an currently un-merged pull request open to add a gevent adapter. https://github.com/pika/pika/pull/860