amqp091-go
RabbitMQ AMQP 0-9-1 client for Go with channels, queues, exchanges and acknowledgements.
Official Documentation ↗amqp091-go v1.10 / RabbitMQ 3.8+ / Go 1.20+. Check the official docs for the latest API surface.Installation
go get github.com/rabbitmq/amqp091-goMethods
No methods match this filter.
Overview
amqp091-go is the RabbitMQ AMQP client for Go. It manages connections, channels, topology declaration, publishing and consumption with manual acknowledgements.
Core Methods
Dial a broker, open a channel, declare queues and exchanges, publish with context, and consume deliveries you ack or nack. Connections are long-lived while channels multiplex operations.
Usage Notes
Declare durable topology, use manual acknowledgements, and route poison messages to a dead-letter queue. Reuse a connection but open a channel per goroutine.
Common Pitfalls
Sharing one channel across goroutines races. Auto-ack loses messages on crash. Requeueing without a limit loops forever, and a closed channel signals a protocol error that must be handled and reopened.
Errors
The official API reference declares the following error types:
amqp.ErrClosed(var *amqp.Error) — official text: “var ( // ErrClosed is returned when the channel or connection is not open ErrClosed = &Error{Code: ChannelError, Reason: “channel/connection is not open”}” (source: https://raw.githubusercontent.com/rabbitmq/amqp091-go/v1.16.0/types.go, fetched 2026-11-08T16:02:45+08:00)amqp.ErrChannelMax(var *amqp.Error) — official text: “ ErrChannelMax = &Error{Code: ChannelError, Reason: “channel id space exhausted”}” (source: https://raw.githubusercontent.com/rabbitmq/amqp091-go/v1.16.0/types.go, fetched 2026-11-08T16:02:45+08:00)amqp.ErrFrameTooLarge(var *amqp.Error) — official text: “ ErrFrameTooLarge = &Error{Code: FrameError, Reason: “frame size exceeds negotiated frame_max”}” (source: https://raw.githubusercontent.com/rabbitmq/amqp091-go/v1.16.0/types.go, fetched 2026-11-08T16:02:45+08:00)
API reference evidence
Fetched from official sources on 2026-11-08T16:02:45+08:00 via WebFetch pkg.go.dev + PowerShell Invoke-WebRequest raw.githubusercontent.com (rabbitmq/amqp091-go v1.16.0).
amqp.Dial→ signature from https://raw.githubusercontent.com/rabbitmq/amqp091-go/v1.16.0/connection.go; official text: “func Dial(url string) (*Connection, error) {”ch.QueueDeclare / ch.PublishWithContext→ signature from https://raw.githubusercontent.com/rabbitmq/amqp091-go/v1.16.0/channel.go; official text: “func (ch *Channel) QueueDeclare(name string, durable, autoDelete, exclusive, noWait bool, args Table) (Queue, error) {”ch.Consume→ signature from https://raw.githubusercontent.com/rabbitmq/amqp091-go/v1.16.0/channel.go; official text: “func (ch *Channel) Consume(queue, consumer string, autoAck, exclusive, noLocal, noWait bool, args Table) (<-chan Delivery, error) {”
FAQ
- What does autoAck do?
- With autoAck true the broker considers a message delivered immediately, so it is lost if the consumer crashes. Use manual ack and acknowledge after successful processing.
- How do connections and channels differ?
- A connection is a TCP session to the broker and is comparatively expensive. Channels are cheap virtual connections within it; most operations happen on a channel, so reuse a channel but do not share it across goroutines.
- How do I avoid infinite redelivery?
- Requeueing a poison message indefinitely loops forever. Limit redelivery with a dead-letter exchange plus a max delivery count, or nack without requeue to drop or route the message.
Report a problem with this API docOpens a pre-filled issue on GitHub.