API Reference

amqp091-go

RabbitMQ AMQP 0-9-1 client for Go with channels, queues, exchanges and acknowledgements.

Official Documentation ↗
CompatibilityThis documentation covers version amqp091-go v1.10 / RabbitMQ 3.8+ / Go 1.20+. Check the official docs for the latest API surface.

Installation

gogo get github.com/rabbitmq/amqp091-go

Methods

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:

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).

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.