Skip to content

Commit

Permalink
Merge pull request #1287 from jpgxs/PikaGeventAdapter
Browse files Browse the repository at this point in the history
Add Gevent adapter
  • Loading branch information
lukebakken committed Feb 4, 2021
2 parents 5af6a4b + 6fa4cfb commit 50e7587
Show file tree
Hide file tree
Showing 20 changed files with 530 additions and 32 deletions.
5 changes: 4 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ Pika provides the following adapters
simple usage.
- ``pika.SelectConnection`` - asynchronous adapter without third-party
dependencies.
- ``pika.adapters.gevent_connection.GeventConnection`` - asynchronous adapter
for use with `Gevent <http://www.gevent.org>`_'s I/O loop.
- ``pika.adapters.tornado_connection.TornadoConnection`` - asynchronous adapter
for use with `Tornado <http://tornadoweb.org>`_'s I/O loop.
- ``pika.adapters.twisted_connection.TwistedProtocolConnection`` - asynchronous
Expand Down Expand Up @@ -252,7 +254,8 @@ New non-blocking adapters may be implemented in either of the following ways:
``pika.BaseConnection`` implements ``pika.connection.Connection``'s abstract
methods, including internally-initiated connection logic. For examples, refer
to the implementations of
``pika.adapters.asyncio_connection.AsyncioConnection`` and
``pika.adapters.asyncio_connection.AsyncioConnection``,
``pika.adapters.gevent_connection.GeventConnection`` and
``pika.adapters.tornado_connection.TornadoConnection``.
- By subclassing ``pika.connection.Connection`` and implementing its abstract
methods. This approach facilitates implementation of custom
Expand Down
6 changes: 4 additions & 2 deletions pika/adapters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
- adapters.asyncio_connection.AsyncioConnection: Native Python3 AsyncIO use
- adapters.blocking_connection.BlockingConnection: Enables blocking,
synchronous operation on top of library for simple uses.
- adapters.gevent_connection.GeventConnection: Connection adapter for use with
Gevent.
- adapters.select_connection.SelectConnection: A native event based connection
adapter that implements select, kqueue, poll and epoll.
- adapters.tornado_connection.TornadoConnection: Connection adapter for use
with the Tornado web framework.
- adapters.twisted_connection.TwistedProtocolConnection: Connection adapter for use
with the Twisted framework
- adapters.twisted_connection.TwistedProtocolConnection: Connection adapter for
use with the Twisted framework
"""
from pika.adapters.base_connection import BaseConnection
Expand Down
5 changes: 5 additions & 0 deletions pika/adapters/asyncio_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@

import asyncio
import logging
import sys

from pika.adapters import base_connection
from pika.adapters.utils import nbio_interface, io_services_utils

LOGGER = logging.getLogger(__name__)


if sys.platform == 'win32':
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())


class AsyncioConnection(base_connection.BaseConnection):
""" The AsyncioConnection runs on the Asyncio EventLoop.
Expand Down

0 comments on commit 50e7587

Please sign in to comment.