Settings¶
func FIFO(s Settings, opts ...FIFOOption) messaging.Backend
func Standard(s Settings) messaging.Backend
func MaxHeadroom() FIFOOption
type Settings struct {
AWS awsclient.Source
Topology Topology
Logger *slog.Logger
Format envelope.Format
Reads []envelope.Format
}
Both constructors take Settings by value and acquire nothing. Defaults are filled in then.
| Field | Type | Default | Meaning |
|---|---|---|---|
AWS |
awsclient.Source |
none: required | Yields the aws.Config the SQS and SNS clients are built from. A nil AWS makes Open fail. See Connect to AWS |
Topology |
sqs.Topology |
sqs.ByName{} |
Resolves the derived queue and topic names into a queue URL and a topic ARN. See Topology and naming |
Logger |
*slog.Logger |
discards (slog.DiscardHandler) |
Receives what the backend cannot return: a message no format could read, a failed receive, a failed heartbeat, a failed settlement |
Format |
envelope.Format |
CloudEvents binary with the ce- prefix: cloudevents.Binary(cloudevents.HTTP) |
Writes every event the backend publishes |
Reads |
[]envelope.Format |
binary with ce-, then structured |
The chain a received message is read with; exactly one format must claim a message. Nil or empty takes the default. A non-empty Reads replaces it |
FIFOOption¶
| Option | Effect | Default |
|---|---|---|
MaxHeadroom() |
FIFO only. Lets a message stay hidden past twelve hours from its receive. See Use all of FIFO's twelve hours | off |
Standard takes no options.
Topology¶
type Topology interface {
QueueURL(ctx context.Context, clients Clients, name string, spec messaging.SourceSpec) (string, error)
TopicARN(ctx context.Context, clients Clients, name string, subject string) (string, error)
}
ByName is the default. See Resolve topics and queues your own way.
How the adapter reads a subscription¶
The adapter has no per-subscription settings of its own. It reads these fields of the
SubscriptionSpec the core hands it, as a messaging.SourceSpec.
| Field | What the adapter does with it |
|---|---|
Pattern |
Must be one exact subject: a pattern containing * or > is refused. It names the topic |
Mode |
AtLeastOnce on either backend; AtMostOnce on FIFO only |
Shape, Group, DurableName |
Pick the queue. AtLeastOnce consumes the queue named by DurableName. AtMostOnce with Competing consumes the queue named by Group. AtMostOnce with Fanout gets a queue of its own |
MaxDeliver |
Under AtLeastOnce, must equal the queue's maxReceiveCount |
AckWait |
The visibility every receive asks for, rounded up to whole seconds. Zero means the queue's VisibilityTimeout, which must then be above zero |
SlowHandler, MaxProcessingTime |
ExtendLease heartbeats every third of AckWait until MaxProcessingTime. MaxProcessingTime above twelve hours is refused, unless FIFO has MaxHeadroom |
Backoff, NackAfter |
A decline hides the message for its delay, up to twelve hours |
Bound |
The size of the buffer between the receiver and the handler. A receive asks for at most the free space, and never more than ten |
StartAt |
AllAvailable is refused by the core at construction, because the adapter declares no replay |
Everything else in the spec is the core's. See the backend contract.