amqp091-go

The official Go client library for the AMQP 0-9-1 protocol, maintained by the RabbitMQ team.

SDK
Go
vv1.14.0
2,032stars
BSD-2-Clause

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
86/100Excellent
Development Activity96
Maintenance84
Community68
Maturity56
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
77/100Good
Architecture85
Code Quality88
Innovation60
Learning Curve75

amqp091-go is the official Go client for AMQP 0-9-1, maintained directly by the RabbitMQ core team as the successor to the widely used streadway/amqp library. It gives Go applications a synchronous, channel-based API for publishing and consuming messages, declaring exchanges and queues, and managing bindings against RabbitMQ or any AMQP 0-9-1 compliant broker.

Beyond the core protocol implementation, the library adds production-oriented features: automatic connection and topology recovery, publisher confirms, TLS support, and hooks for observing asynchronous broker events like acks, nacks, and flow-control signals. It targets the two most recent Go release series and is exercised against real RabbitMQ instances in CI, making it the default choice for Go services that need a battle-tested, actively maintained AMQP client.

What You Get

  • Full AMQP 0-9-1 protocol coverage - connections, channels, exchanges, queues, bindings, and the basic/confirm/tx method classes
  • Automatic connection and topology recovery - a Recovery config reconnects and replays exchange, queue, binding, and consumer declarations after a dropped connection
  • Publisher confirms and asynchronous notifications - Notify* methods surface acks, nacks, returns, flow-control, and blocked-connection events
  • TLS and pluggable SASL authentication - amqps:// connections plus PLAIN and EXTERNAL auth mechanisms, extensible for custom mechanisms

Common Use Cases

  • Publishing events from a Go service into RabbitMQ exchanges for downstream consumers
  • Building worker processes that consume from queues with manual or automatic acknowledgement
  • Implementing request/reply RPC patterns over AMQP with correlation IDs and reply-to queues
  • Running resilient long-lived consumers that survive network blips via automatic topology recovery

Under The Hood

Architecture The library is organized around three cooperating layers: a low-level frame reader/writer (read.go, write.go, spec091.go) that encodes and decodes the AMQP 0-9-1 wire format; a Connection type (connection.go) that owns the TCP/TLS socket, heartbeat, and a background demultiplexing goroutine that routes incoming frames to the right Channel by channel number; and a Channel type (channel.go) that exposes the synchronous, RPC-style public API (Publish, Consume, QueueDeclare, etc.) built on top of internal call/response plumbing. A separate recovery.go layer wraps Connection and Channel to transparently replay topology (exchanges, queues, bindings, consumers) after a dropped connection, using consumerConfig-style stored parameters. Broadcasting to multiple listeners (Notify* channels) goes through a shared notifyAll helper with a bounded timeout so a slow listener can never wedge the reader goroutine — a concrete resilience mechanism baked into the core, not bolted on.

Tech Stack Written in pure Go (module github.com/rabbitmq/amqp091-go, go.mod requires Go 1.20) with a single external dependency, go.uber.org/goleak, used only for leak detection in tests. It relies entirely on the standard library for networking and TLS (net, crypto/tls, crypto/x509, bufio) rather than any third-party framework, keeping the runtime dependency footprint at effectively zero. Build tooling is a Makefile plus shell/PowerShell scripts for generating the protocol spec and managing TLS certs for integration tests; CI runs via GitHub Actions with a matrix across supported Go versions and a CodeQL security-scanning workflow.

Code Quality Testing is extensive: over 200 test functions across unit, integration (client_test.go, integration_test.go), and dedicated recovery test suites (recovery_test.go alone is substantial), gated behind an integration build tag so unit and live-broker tests can run separately. Error handling is explicit and idiomatic Go — errors are returned rather than swallowed, and connection/channel failures propagate through NotifyClose channels. The project enforces golangci-lint (.golangci.yml) with the modernize linter enabled and only a few rules disabled for justified cases (e.g. relaxed complexity limits on integration_test.go). Naming and package structure are consistent and idiomatic, and CHANGELOG.md is actively maintained alongside tagged releases.

API Design The public API deliberately mirrors AMQP protocol method names and parameters (Channel.QueueDeclare, Channel.ExchangeBind, etc.), trading some Go idiom for a one-to-one mapping developers can cross-reference against the AMQP 0-9-1 spec. Synchronous methods return errors immediately in RPC fashion, while asynchronous protocol events (acks, flow, returns) are exposed through opt-in Notify* channel subscriptions rather than callbacks, keeping the base API simple for the common publish/consume path while still surfacing lower-level broker behavior for applications that need it. Godoc comments are thorough throughout doc.go and the public types, and the _examples directory (client, producer, consumer, pubsub, recovery) gives runnable references for the main integration patterns.

Used by 5 apps in this directory

Go
72%
Other

Convoy

Developer Tools · Devops

2,862

Convoy is an open-source, cloud-native webhooks gateway that ingests events over HTTP or straight from Kafka, SQS, Google Pub/Sub, and RabbitMQ, then reliably delivers them to subscriber endpoints with signed payloads, automatic retries, circuit breaking, and JavaScript-based transformations.

View details
88
Repo Health
81
Technical
65
Dependency
Built with
Go72%
TypeScript15%
HTML12%
Updated 5 days ago
Go
92%
AGPL 3.0

Cozy Stack

File Storage · Productivity

1,270

Self-hosted personal cloud platform that unifies your files, apps, and devices in one private space you fully control.

View details
94
Repo Health
77
Technical
67
Dependency
Built with
Go92%
Updated 3 days ago
Go
84%
MIT

Hatchet

AI Development · Developer Tools · Automation

7,885

A Postgres-backed orchestration engine for background tasks, AI agents, and durable workflows that replaces Redis queues and multi-datastore durable execution platforms with a single self-hostable service.

View details
87
Repo Health
83
Technical
67
Dependency
Built with
Go84%
PLpgSQL11%
Updated 2 days ago
Go
99%
AGPL 3.0

MinIO

File Storage

61,373

High-performance, S3-compatible object storage built for AI/ML and analytics workloads — run it anywhere from a laptop to a petabyte-scale cluster.

View details
59
Repo Health
85
Technical
64
Dependency
Built with
Go99%
Updated 4 months ago
Go
98%
Other

Tyk API Gateway

Developer Tools · Devops

10,817

Cloud-native, high-performance open-source API gateway for REST, GraphQL, gRPC, and TCP — built in Go since 2014 with no feature lockout.

View details
97
Repo Health
78
Technical
66
Dependency
Built with
Go98%
Updated yesterday

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search