Skip to content

Settings

func New(ctx context.Context, s Settings, management Management) (messaging.Backend, error)

Source: backend.go, settings.go. New applies the defaults below to its own copy of Settings.

Field Type Default Meaning
URL string none The AMQP 1.0 endpoint, amqp:// or amqps://.
Username, Password string empty SASL PLAIN credentials. If either is non-empty the connection offers SASL PLAIN with both; if both are empty no SASL mechanism is set.
DefaultAckWait time.Duration 30s The lease when a subscription's AckWait is zero. Zero or negative takes the default.
Logger *slog.Logger discards Receives what the backend cannot return as an error.
Topology Topology ByName{} Resolves the queue an at-least-once subscription attaches to. ByName returns the subscription's DurableName.
Format envelope.Format CloudEvents binary, AMQP binding Writes every event this backend publishes.
Reads []envelope.Format CloudEvents binary (AMQP binding), then CloudEvents structured The chain a received message is read with. Exactly one format must claim a message.

The second argument must not be nil. New(ctx, s, nil) fails with messaging-amqp: a Management is required; nothing under at-least-once can be verified without one. amqp.Artemis{} is the Management that ships.

New dials the broker once, reads its Features through the Management, and closes that connection. An unreachable broker, a refused login or a Management that cannot read the broker fails here. This is unlike the core's own constructor, which does not connect: see Connect to a broker.

Fixed values

These are constants in the code and have no setting.

Value Where Meaning
10 s linkBudget, session.go Longest the adapter waits to attach a link, settle a message, or close a session.
10 s managementBudget, artemis.go Longest a single request to Artemis's management address may take.
10 replyCredit, artemis.go Credit on the management reply link.

Topology

type Topology interface {
    Queue(ctx context.Context, sess *goamqp.Session, address string, spec messaging.SourceSpec) (string, error)
}

Returns the name of the queue on address that the subscription attaches to. address is the subscription's pattern already translated (see Topology it expects). The session is passed so an implementation can use the Management over the same connection. An implementation may create the queue on first resolve, as the module's test fixture does. The adapter itself verifies and never creates.

Defaults the core applies

The subscription-level settings that reach this backend (Bound, MaxDeliver, AckWait, SlowHandler and so on) are the core's: see SubscriptionSpec. The ones this backend reads are described in Delivery, settlement and flow control.