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, Request a subject that cannot be published to
ErrNotReady Publish, Subscribe, Request 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, Request once shutdown has begun: accepting a subscription that will never be supervised would be worse than refusing it. Request returns it for a request Stop cancelled
ErrNoSource PublishValue, RequestValue, New the bus was built without Settings.Source, which CloudEvents needs as half of an event's identity. A Responder is refused without one, because it could not build a failure reply
ErrNoDeadline Request the request's context has no deadline
ErrNoResponders Request, a session nothing is subscribed to the subject, so nothing received the request
ErrNoReply Request the context ended before a reply; wraps the context's error
ErrResponderFailed Request the responder returned an error, panicked, or returned a reply that could not be sent
ErrReservedAttribute Publish, Request the event carries messagingfailed, the extension attribute that marks a failure reply
ErrNoReplyAddress Answer the delivery was published, not requested
ErrNoSubscriptions nothing deprecated: New accepts an empty Settings.Subscriptions, so a process that only publishes can build a bus. Kept so code naming it compiles, and removed before 1.0
ErrQueueFull Publish, Request the subscription's overflow policy is Fail. On the in-memory backend a request returns it when every responder group refused it
ErrNotSupported a backend, validateMode, Request, New, Subscribe asked for a capability or delivery mode it does not have. Request returns it on a backend without RequestReply, and New and Subscribe refuse a Responder there with it. New and Subscribe refuse a delaying subscription on a backend without DelaysRedelivery, and Delivery.NackAfter returns it on a subscription that does not delay
ErrContentType Delivery.Decode the payload's DataContentType is not the bus's codec's
ErrAlreadySettled Delivery.Ack, Delivery.Nack, Delivery.NackAfter, SettleWith a second settlement on one delivery; the first call wins
ErrNackDelay Delivery.NackAfter, SettleWith a negative delay, one above the subscription's ceiling, or a delay on an Acked settlement. Nothing is recorded, so the handler can still Nack
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