API Reference
aio-pika
An asyncio AMQP client for RabbitMQ built on aiormq, with robust connections and pools.
Official Documentation ↗CompatibilityThis documentation covers version
v9.4. Check the official docs for the latest API surface.Installation
pip
pip install aio-pikaMethods
No methods match this filter.
aio-pika offers async publish and consume with automatic reconnection and channel pooling.
Key Features
- Robust connections that auto-reconnect
- Async queues and exchanges
- Channel and connection pools
Usage Notes
Pin a version and check the official docs for the API surface you depend on before upgrading.
Errors
The official API reference declares the following error types:
aio_pika.exceptions.MessageProcessError(exception) — official text: “class MessageProcessError(AMQPError): reason = “%s: %r”” (source: https://raw.githubusercontent.com/mosquito/aio-pika/master/aio_pika/exceptions.py, fetched 2026-11-08T16:03:08.4363995+08:00)aio_pika.exceptions.QueueEmpty(exception) — official text: “class QueueEmpty(AMQPError, asyncio.QueueEmpty): pass” (source: https://raw.githubusercontent.com/mosquito/aio-pika/master/aio_pika/exceptions.py, fetched 2026-11-08T16:03:08.4363995+08:00)
API reference evidence
Fetched from official sources on 2026-11-08T16:03:08.4363995+08:00 via WebFetch 官方文档站(apidoc 入口回退为官网首页);签名取自官方仓库 aio_pika 源码 docstring.
aio_pika.connect_robust→ signature from https://raw.githubusercontent.com/mosquito/aio-pika/master/aio_pika/robust_connection.py; official text: “async def connect_robust(url: str | URL | None = None, *, host: str = ‘localhost’, port: int = 5672, login: str = ‘guest’, password: str = ‘guest’, virtualhost: str = ‘/’, ssl: bool = False”channel.declare_queue→ signature from https://raw.githubusercontent.com/mosquito/aio-pika/master/aio_pika/channel.py; official text: “async def declare_queue(name: Optional[str] = None, *, durable: bool = False, exclusive: bool = False, passive: bool = False, auto_delete: bool = False, arguments: Arguments = None, timeout: TimeoutType = None) -> Abstra”queue.consume→ signature from https://raw.githubusercontent.com/mosquito/aio-pika/master/aio_pika/queue.py; official text: “async def consume(callback: Callable[[AbstractIncomingMessage], Awaitable[Any]], no_ack: bool = False, exclusive: bool = False, arguments: Arguments = None, consumer_tag: Optional[ConsumerTag] = None, timeout: TimeoutTyp”
FAQ
- How does process() help?
- The async context manager acks on success and rejects on exception, making acknowledgement implicit and harder to get wrong.
- Should I create a connection per request?
- No. Reuse one robust connection and pool channels; connect_robust handles reconnection transparently.
- How do I publish with confirms?
- Enable publisher confirms on the channel and await the returned delivery tag to guarantee broker acceptance.
Report a problem with this API docOpens a pre-filled issue on GitHub.