Skip to content

Reference

Page Covers
Subjects and patterns The token rules, what Match does, and why validation refuses more than NATS does
The backend contract Backend, Session, Source, Capabilities, SubscriptionSpec, and the one requirement placed on an implementer

Where the generated API listing lives

This tier is written by hand and states behaviour the type signatures do not. The generated listing of every exported symbol is on pkg.go.dev.

Errors

Sentinel Returned by When
ErrInvalidPattern ValidatePattern, New a subject pattern this module refuses
ErrInvalidSubject ValidateSubject, Publish a subject that cannot be published to
ErrNotReady Publish, Subscribe before the first Start, during a reactivation gap, or after Stop. Publish never returns ErrStopped, because a publisher's response to "no live activation" is the same whichever caused it
ErrStopped Subscribe once shutdown has begun: accepting a subscription that will never be supervised would be worse than refusing it
ErrNoSource PublishValue the bus was built without Settings.Source, which CloudEvents needs as half of an event's identity
ErrNoSubscriptions New Settings.Subscriptions is empty
ErrQueueFull Publish the subscription's overflow policy is Fail
ErrNotSupported a backend, or validateMode asked for a capability or delivery mode it does not have
ErrContentType Delivery.Decode the payload's DataContentType is not the bus's codec's
ErrAlreadySettled Delivery.Ack, Delivery.Nack a second settlement on one delivery; the first call wins
ErrSettlementRefused a backend, via Settle it could not perform a settlement: the source retired, the session closed, or the broker was unreachable

New also returns a plain error, not a sentinel, when called with a nil backend: "a bus needs a backend" is a caller mistake with nothing to match against programmatically, so it is not one of the sentinels above.

Constants

Symbol Value Meaning
DefaultQueueBound 256 How many messages a subscription may hold when Bound is zero. That there is a bound is this module's and not negotiable; the number is the caller's
DefaultMaxProcessingTime five minutes MaxProcessingTime when a subscription leaves it zero under ExtendLease