Skip to content

The RabbitMQ adapter

Run a go/messaging bus on RabbitMQ, on quorum queues the operator owns.

gitlab.com/phpboyscout/go/messaging-rabbitmq is the RabbitMQ backend for go/messaging. It speaks AMQP 0-9-1 through rabbitmq/amqp091-go and asks the HTTP management API for everything the wire cannot say about a queue. rabbitmq.New(Settings) returns a messaging.Backend:

backend := rabbitmq.New(rabbitmq.Settings{
    URL:        "amqp://localhost:5672/",
    Management: rabbitmq.Management{URL: "http://localhost:15672", Username: "guest", Password: "guest"},
    Exchange:   "events",
})

It offers AtMostOnce and AtLeastOnce, and its messages survive a broker restart. It verifies and never creates: the exchange, every at-least-once queue, its bindings and its dead-letter configuration are the operator's, and Open and Subscribe refuse, naming what they found, when they are wrong. It has no replay, no delayed redelivery, no request and reply, and no overflow policy. Capabilities lists each.

A publish is never deduplicated. RabbitMQ has no publisher-side identity, so a publish retried after an ambiguous failure can be stored and delivered twice. Handlers must be idempotent.

It is pre-1.0 and tracks the core. This section describes its main branch, and its changelog says which release carries each change. The design is go/messaging's spec 0009. Where this section and a spec differ, this section describes the code.

It is tested against RabbitMQ 4.3.5 only; see Tested versions.

Start here

Consume from RabbitMQ prepares a quorum queue, runs a bus against it, publishes an event, and shows a handler that keeps declining it end up in the dead-letter queue.

Do a task

Understand it

Look something up