Context ManagerΒΆ
connect()
is an asynchronous context manager that returns a connected instance of the aiorabbit.client.Client
class. When exiting the runtime context, the client connection is automatically closed.
-
aiorabbit.
connect
(url='amqp://guest:guest@localhost:5672/%2f', locale='en-US', product='aiorabbit/1.0.0a1', loop=None)[source]ΒΆ Asynchronous context-manager that connects to RabbitMQ, returning a connected
Client
as the target.async with aiorabbit.connect(RABBITMQ_URL) as client: await client.exchange_declare('test', 'topic')
- Parameters
url (
str
) β The URL to connect to RabbitMQ withlocale (
str
) β The locale for the connection, default en-USproduct (
str
) β The product name for the connection, default aiorabbitloop (
typing.Optional
[asyncio.events.AbstractEventLoop
]) β Optionalasyncio
event loop to use