Skip to content

Settings

rabbitmq.New(Settings) returns a messaging.Backend. It validates nothing and connects nothing; a missing endpoint shows when the bus calls Open.

Settings

Field Type Default Meaning
URL string none; required The AMQP 0-9-1 endpoint, amqp:// or amqps://, credentials included. Passed to amqp.Dial, so its virtual host is the URL's path.
Management Management none; required The HTTP management API.
Exchange string none; required The operator's topic exchange: the subject space. It must exist, or Open fails with ErrNoExchange.
Topology Topology ByName{} Resolves the queue an at-least-once subscription consumes.
DefaultAckWait time.Duration 30 seconds when zero or negative The lease under Redeliver when a subscription sets no AckWait.
Logger *slog.Logger discards Receives what the backend cannot return: consumer cancellations, channel closures, unreadable messages, a failed give-back.
Format envelope.Format CloudEvents binary with the ce- prefix Writes every event published.
Reads []envelope.Format CloudEvents binary with the ce- prefix, then structured The chain a received message is read with. Exactly one format must claim a message. A non-empty Reads replaces the default.

Management

Field Default Meaning
URL none; required The API's base, such as http://host:15672. A trailing slash is trimmed.
Username none Basic-auth user.
Password none Basic-auth password.
VHost / when empty The virtual host in the API's path. The AMQP virtual host comes from Settings.URL.

Requests use a client with a 10 second timeout.

Topology

type Topology interface {
    Queue(ctx context.Context, spec messaging.SourceSpec) (string, error)
}

Queue returns the quorum queue an at-least-once subscription consumes. It is not called for AtMostOnce. The adapter verifies whatever name comes back. ByName{} returns spec.DurableName. An operator's tool may create the queue on resolve; the adapter never does.

What the subscription supplies

These SubscriptionSpec fields reach the adapter in messaging.SourceSpec and decide its behaviour:

Field Used for
Mode AtLeastOnce or AtMostOnce; any other value is refused with ErrNotSupported.
DurableName The queue's name under the default Topology.
Pattern The binding to verify (at-least-once) or make (at-most-once), translated to the topic grammar.
Shape, Group Under AtMostOnce, which transient queue: fan-out is an exclusive server-named queue, competing is the queue named by Group.
MaxDeliver The last attempt, and the minimum delivery limit (MaxDeliver - 1).
Bound The consumer's prefetch.
SlowHandler, AckWait, MaxProcessingTime The lease. See How a message is settled.

StartAt and AllowVolatile have no effect: the adapter has no replay, and it survives a restart.