Documentation
¶
Overview ¶
Package sqs is a queue store on Amazon SQS, as a gas.JobQueueProvider. It sends its requests with the AWS SDK for Go v2, so it also reaches an emulator that speaks the SQS API, such as ElasticMQ or LocalStack.
Service implements gas.Service, gas.JobQueueProvider and gas.ReadyReporter, and keeps the contract of the queue package.
Usage ¶
In an app, the container builds the store from New and calls its Init. By hand, with a configuration given in code:
cfg := sqs.DefaultConfig()
cfg.Queue.Region = "eu-west-1"
q, err := sqs.New(sqs.WithConfig(cfg))(nil, logger)
if err != nil {
return err
}
if err := q.Init(ctx); err != nil {
return err
}
defer q.Close(ctx)
err = q.Enqueue(ctx, "orders", []byte(`{"id":42}`))
After this the SQS queue `orders` of the account the credentials belong to holds the message.
Configuration ¶
The settings live in the `queue` section, in Settings:
- `queue.region`: the AWS region. Default: none; the AWS SDK's default chain decides, as under Credentials.
- `queue.endpoint`: the URL requests go to, `http` or `https`, with a host and nothing after it but `/` (no user information, path, query or fragment), such as an emulator's. Default: none, the region's SQS endpoint. An `http` endpoint sends every request in clear text, the access key ID, the session token and the payloads included. Use it only for an emulator on a network of its own, such as `http://elasticmq:9324` in a compose file.
- `queue.accesskeyid`, `queue.secretaccesskey`, `queue.sessiontoken`: static credentials, as under Credentials. The access key ID is not a secret, but it maps to the AWS account ID, and the store never logs it. The secret key and the token are each a Secret, which prints, marshals to JSON or YAML, and logs with log/slog as `[redacted]`. Default: none.
- `queue.optimeout`: the bound of each request, retries included, above 0, as under Timeouts. Default: DefaultOpTimeout (10s).
- `queue.visibilitytimeout`: how long a message Dequeue returns stays hidden, 1s to 12h, rounded up to a whole second, or 0, which sends none, for the queue's own. Default: DefaultVisibilityTimeout, 0.
- `queue.maxretries`: how many times a failed request is retried, 0 to MaxRetries (10), with the AWS SDK's standard retryer and its backoff. Default: DefaultMaxRetries, 2, so 3 attempts.
Service.Init resolves the configuration each time it runs, from one of two sources:
- Without WithConfig, it binds DefaultConfig from the gas.ConfigProvider, which checks the `validate` tags. A nil ConfigProvider is the error queue.ErrNoConfigProvider.
- With WithConfig, it takes a copy of the given Config, never changing the caller's struct, and checks the same tags. A nil Config is the error queue.ErrNilConfig.
Either way, these rules then run, in this order, and the first that fails is the error:
- `visibilitytimeout` is 0 or at least a second.
- `endpoint`, when set, is an `http` or `https` URL with a host and nothing more but `/`.
A failure wraps queue.ErrInvalidConfig and names the setting, never its value.
Service.Config returns a copy of the configuration the last successful Init resolved, defaults included, or the zero Config before one. A failed Init and Close leave it as it was. Its `secretaccesskey` and `sessiontoken` stay a Secret, which prints as `[redacted]`.
Credentials ¶
Init builds the client with the AWS SDK's default configuration, which comes from:
- the environment, such as `AWS_REGION` and `AWS_ACCESS_KEY_ID`;
- the shared configuration and credentials files, and their profile;
- the container and instance roles.
Its HTTP client is the store's own, on the AWS SDK's default transport. It follows no redirect, as the SDK's does not.
A `region` setting takes precedence over the chain's region. Without one, a region the chain does not find fails Init with ErrNoRegion.
Static credentials are used when both `accesskeyid` and `secretaccesskey` are set, with `sessiontoken` when it is set too. With either key empty, the chain's credentials apply, as config/secretsmanager does it, and the other static values are not used. When some of them are set, but not both keys, Init logs `static credentials incomplete, using the default chain` at warn level, with `missing` naming the keys that are not set, never a value.
AWS configuration that fails to load, such as a profile that does not exist, fails Init with queue.ErrInvalidConfig.
Init retrieves the credentials within its context and `optimeout`, so that it fails, with ErrNoCredentials, when there are none, rather than the first request. The client then refreshes them as they expire. Init sends no request to SQS.
WithClient gives the store a client to use instead, such as an *sqs.Client built elsewhere or a fake of API. `region`, `endpoint`, the credentials and `maxretries` then have no effect, and Init neither checks a region nor retrieves credentials.
Queues ¶
A queue is named as the queue package describes. A queue URL is sent as it is.
A queue name is resolved with GetQueueUrl, which needs the `sqs:GetQueueUrl` permission, on the first call that uses it:
- The URL is kept until Close.
- It is dropped when a request finds the queue does not exist, so a queue deleted and created again is resolved anew.
- A reply that is not a queue URL, as queue.ParseQueue reads one, of the name asked for, fails the call with an invalid reply, and is not kept.
Requests go to `endpoint`, or to the region's endpoint, whatever the host of a queue URL.
Sending ¶
Enqueue is SendMessage:
- Every attribute is sent as a `String`.
- A delay is sent in whole seconds, rounded up, and none when it is 0, so the queue's own delay applies.
- The AWS SDK checks the MD5 digest SQS returns against the payload, which the payload rules keep valid.
On a FIFO queue, a message without a dedupe ID that SQS refuses with InvalidParameterValue, as it does on a queue without content-based deduplication, gets an error that wraps queue.ErrInvalidArgument too.
Receiving ¶
Dequeue is ReceiveMessage. It sends:
- maxMessages;
- its wait in whole seconds, rounded up, and a wait of 0 as `"WaitTimeSeconds":0`, which the AWS SDK otherwise leaves out, so a queue whose ReceiveMessageWaitTimeSeconds attribute is set still answers a short poll at once;
- `visibilitytimeout`, unless it is 0;
- a request for every message attribute, and for the system attributes the queue package lists;
- on a FIFO queue, a ReceiveRequestAttemptId of its own, so that a retry by the AWS SDK gets the same messages instead of hiding them.
A job holds each message attribute with a string value, Number ones included. It does not hold Binary ones, which a producer outside the module may send, nor one with the name of a system attribute, whose place the system attribute takes.
A reply with more than maxMessages messages, or with a message without an ID or a receipt handle, is an invalid reply. Dequeue makes its messages that have both visible again, as Close's release does, and returns the error, with no jobs.
Acknowledging ¶
Ack is DeleteMessage. Nack, NackAfter and Extend are ChangeMessageVisibility, with the visibility timeout in whole seconds, rounded up, 0 for Nack; the AWS SDK sends 0 too.
A message no longer leased under the job's receipt handle gets an error reply:
- MessageNotInflight wraps queue.ErrNotInFlight.
- ReceiptHandleIsInvalid wraps queue.ErrInvalidReceipt.
- InvalidParameterValue, which LocalStack sends, wraps ErrCommand alone.
ElasticMQ and LocalStack accept a Nack of a message whose lease has ended, which SQS documents as MessageNotInflight.
Timeouts ¶
Every request runs within its context and `optimeout`, whichever ends first, the AWS SDK's retries and their backoff included. So a server that stops answering cannot hold a call longer than `optimeout`, even with a context that never ends. A Dequeue runs within its wait plus `optimeout`.
The SDK retries a request after a network error, a throttle and a server error, up to `maxretries` times. A send whose reply was lost can then be stored twice, as at-least-once delivery allows.
Connection errors ¶
A request that fails at the connection returns an error wrapping ErrConnect and a reason, never the AWS SDK's error, which holds the endpoint. The reasons:
- `timed out`: a deadline passed, in a context or on the network. The error then wraps context.DeadlineExceeded too.
- `connection refused`: the endpoint refused the TCP connection.
- `unreachable`: any other network error, such as a failed name lookup.
A call whose own context ended returns the context's error after `<op> "<queue>": `, wrapped, without ErrConnect.
Which of the two a timeout is depends on which deadline was in force. A timeout of a call whose context's deadline is no later than `optimeout`'s is the context's error.
Error replies ¶
An error reply of SQS returns an error wrapping ErrCommand, with a reason told by its AWS error code. The code follows, in parentheses, when it is one SQS or the AWS APIs document. The reply's message, which can quote a receipt handle, an attribute name or a parameter's value, is never kept, nor a code of any other text.
The reasons, in the order they are told:
- `queue does not exist`: QueueDoesNotExist, also wrapping queue.ErrQueueNotFound.
- `access denied`: AccessDenied, InvalidClientTokenId, SignatureDoesNotMatch, ExpiredToken and the other codes of refused credentials or permissions, also wrapping ErrAccessDenied.
- `throttled`: RequestThrottled, ThrottlingException and the KMS throttles, also wrapping ErrThrottled.
- `invalid receipt handle`: ReceiptHandleIsInvalid, also wrapping queue.ErrInvalidReceipt.
- `message not in flight`: MessageNotInflight, also wrapping queue.ErrNotInFlight.
- `invalid reply`: a reply SQS does not send: a body larger than 64 MiB, which the client Init builds stops reading at, a client of WithClient that returns neither an output nor an error, a ReceiveMessage or GetQueueUrl reply as under Receiving and Queues.
- `failed`: any other reply, or a request that failed for another reason, such as a reply that is not valid JSON.
Lifecycle ¶
A successful Init publishes the client and logs `service initialized` at info level, with:
- `region`;
- whether an `endpoint` and a `client` were given;
- `credentials`, where the client Init built takes them from, `static` or `default chain`, left out with WithClient;
- `op_timeout`.
Only then do the methods use the client. Init on an initialized store returns queue.ErrAlreadyInitialized and changes nothing. A failed Init leaves the store as it was.
Out of the initialized state:
- Before the first successful Init, every method but Init, Close, Name, Client and Config returns an error wrapping queue.ErrNotInitialized.
- After Close, until Init succeeds, they return queue.ErrClosed.
New's constructor fails with queue.ErrNilLogger for a nil logger. A nil ConfigProvider is accepted, and Init then requires WithConfig. A nil client given to WithClient fails Init with ErrNilClient.
Closing ¶
Service.Close runs these steps, in order:
- It makes the store closed, so that every later call returns queue.ErrClosed.
- It waits for every call in flight to return. While its context lasts, it does not cut a call short.
- It closes the idle connections of the client Init built.
- It logs `service closed` at info level.
A Dequeue that has not sent its receive when Close begins sends none and returns queue.ErrClosed. A Dequeue in flight:
- finishes its receive, which ends when a message comes or its wait ends;
- makes what it received visible again, with one ChangeMessageVisibilityBatch of 0, all within one `optimeout`;
- returns queue.ErrClosed, joined with the error of the request, or of each entry SQS reports failed.
So Close can take as long as the longest wait in flight plus twice `optimeout`: one for the receive, one for the release.
Cutting the receive short instead could strand messages. ElasticMQ and LocalStack both hand a message sent during a receive to that receive after its client has gone, where it stays hidden for its visibility timeout, and SQS documents nothing that rules it out. A Dequeue whose own context ends while it waits cuts its receive the same way, so give a worker's Dequeue a context that outlives its wait.
When Close's context ends before the calls in flight return, Close:
- cancels their requests, which may strand what a receive was handed as above;
- logs `service closed, calls in flight canceled` at warn level;
- returns an error wrapping the context's error.
The store stays closed, and the canceled calls return queue.ErrClosed.
Close on a store that is not initialized returns nil and logs nothing. Init after Close builds a new client, with a configuration resolved afresh.
Readiness ¶
Service.CheckReady does no I/O: it fails only when the store is not initialized or its context has ended. There is no queue it could check without being told one.
Client ¶
Service.Client returns the *sqs.Client, for the operations the store has no method for, such as CreateQueue and PurgeQueue. It returns nil when the store is not initialized or was given another API.
Requests sent on it are bounded only by their own context, and return the AWS SDK's errors as they are, which can hold the endpoint and the queue URL.
Security ¶
No error the store makes and no log it writes holds a payload, an attribute, a receipt handle, a queue URL, the endpoint, or a credential, the access key ID included. The logs carry:
- the region;
- whether an endpoint and a client were given;
- where the credentials come from;
- the names of the static keys missing;
- the operation timeout.
fmt, encoding/json, YAML encoders that use encoding.TextMarshaler, and log/slog write the secret key and the session token of a Settings or a Config as `[redacted]`. encoding/gob fails on them rather than encode them.
Static credentials in configuration are a secret of the app's. Prefer a role, which the default chain finds.
An `http` endpoint sends the access key ID, the session token and the payloads in clear text, as under Configuration. The secret key only signs requests and is never sent.
The client Init builds reads no reply past 64 MiB, so an endpoint cannot make it read without bound. It logs nothing: the AWS SDK's default logger, which writes raw transport errors holding the endpoint, is replaced with one that discards them.
Concurrency ¶
A Service is safe for concurrent use. Init and Close run one at a time.
Init swaps in what it built at once. So the other methods, which take no lock but to count themselves in flight, use one Init's client throughout a call. The resolved queue URLs are kept under a lock.
Errors ¶
The sentinel errors of this package, to be tested with errors.Is:
- ErrNoRegion: Init found no region.
- ErrNoCredentials: Init could not retrieve credentials.
- ErrNilClient: WithClient was given a nil client.
- ErrConnect: a request got no reply, as under Connection errors.
- ErrCommand: SQS replied with an error, or with an invalid reply, or a request failed for another reason, as under Error replies.
- ErrAccessDenied, ErrThrottled: kinds of ErrCommand.
The other errors wrap a sentinel of the queue package, as the queue package describes. Every error starts with ServiceName and the operation. A configuration that fails its tags gets the validator's error after `gas/queue/sqs: init: invalid config: validate config: `, such as:
Key: 'Config.Queue.OpTimeout' Error:Field validation for 'OpTimeout' failed on the 'gt' tag
The other errors, as returned, with `enqueue` standing for each operation that can fail the same way:
gas/queue/sqs: logger is nil gas/queue/sqs: init: config is nil gas/queue/sqs: init: no config provider gas/queue/sqs: init: invalid config: Queue.VisibilityTimeout must be 0 or 1s to 12h gas/queue/sqs: init: invalid config: Queue.Endpoint must be an http or https URL with a host and nothing more but / gas/queue/sqs: init: invalid config: AWS configuration failed to load gas/queue/sqs: init: no region gas/queue/sqs: init: no credentials: failed gas/queue/sqs: init: no credentials: timed out gas/queue/sqs: init: no credentials: timed out: context deadline exceeded gas/queue/sqs: init: client is nil gas/queue/sqs: init: service already initialized gas/queue/sqs: init: context canceled gas/queue/sqs: ready: service not initialized gas/queue/sqs: enqueue: invalid queue: empty gas/queue/sqs: enqueue "orders": invalid payload: empty gas/queue/sqs: enqueue "orders": service not initialized gas/queue/sqs: enqueue "orders": service closed gas/queue/sqs: enqueue "orders": context canceled gas/queue/sqs: enqueue "orders": context deadline exceeded gas/queue/sqs: enqueue "orders": timed out gas/queue/sqs: enqueue "orders": connection refused gas/queue/sqs: enqueue "orders": unreachable gas/queue/sqs: enqueue "orders": queue does not exist (QueueDoesNotExist) gas/queue/sqs: enqueue "orders": access denied (AccessDenied) gas/queue/sqs: enqueue "orders": throttled (RequestThrottled) gas/queue/sqs: enqueue "orders": failed (InvalidParameterValue) gas/queue/sqs: enqueue "orders": failed gas/queue/sqs: ack "orders": invalid receipt handle (ReceiptHandleIsInvalid) gas/queue/sqs: nack "orders": message not in flight (MessageNotInflight) gas/queue/sqs: dequeue "orders": service closed gas/queue/sqs: dequeue "orders": invalid reply gas/queue/sqs: close: context deadline exceeded
Index ¶
- Constants
- Variables
- func New(opts ...Option) func(gas.ConfigProvider, gas.Logger) (*Service, error)
- type API
- type Config
- type Option
- type Secret
- type Service
- func (s *Service) Ack(ctx context.Context, id string, job gas.Job) error
- func (s *Service) CheckReady(ctx context.Context) error
- func (s *Service) Client() *awssqs.Client
- func (s *Service) Close(ctx context.Context) error
- func (s *Service) Config() Config
- func (s *Service) Dequeue(ctx context.Context, id string, maxMessages int, wait time.Duration) ([]gas.Job, error)
- func (s *Service) Enqueue(ctx context.Context, id string, payload []byte, opts ...gas.EnqueueOption) error
- func (s *Service) Extend(ctx context.Context, id string, job gas.Job, d time.Duration) error
- func (s *Service) Init(ctx context.Context) error
- func (s *Service) Nack(ctx context.Context, id string, job gas.Job) error
- func (s *Service) NackAfter(ctx context.Context, id string, job gas.Job, d time.Duration) error
- func (*Service) Name() string
- type Settings
Constants ¶
const ( // DefaultOpTimeout is the bound of each request of DefaultConfig, and // what a Dequeue may take past its wait. DefaultOpTimeout = 10 * time.Second // DefaultVisibilityTimeout is the visibility timeout of Dequeue in // DefaultConfig: 0, the queue's own. DefaultVisibilityTimeout time.Duration = 0 // DefaultMaxRetries is how many times DefaultConfig retries a failed // request: 2, so 3 attempts, as the AWS SDK's standard retryer makes // by default. DefaultMaxRetries = 2 // MaxRetries is the most retries the MaxRetries setting allows. MaxRetries = 10 )
const ServiceName = "gas/queue/sqs"
ServiceName is the name of the SQS store, returned by Service.Name and prefixed to every error the store returns.
Variables ¶
var ( // ErrNoRegion indicates that Init found no AWS region, in the Region // setting or the AWS SDK's default chain. ErrNoRegion = errors.New("no region") // ErrNoCredentials indicates that Init could not retrieve AWS // credentials. ErrNoCredentials = errors.New("no credentials") // ErrNilClient indicates that WithClient was given a nil client. ErrNilClient = errors.New("client is nil") // ErrConnect indicates that a request got no reply from SQS: it timed // out, its connection was refused, or the endpoint was unreachable, as // described in the package documentation. ErrConnect = errors.New("no reply") // ErrCommand indicates that SQS replied to a request with an error, or // that a request failed for another reason than ErrConnect's, as // described in the package documentation. ErrCommand = errors.New("request failed") // ErrAccessDenied indicates that SQS refused the credentials, or their // permission for the request. It comes with ErrCommand. ErrAccessDenied = errors.New("access denied") // ErrThrottled indicates that SQS throttled the request, past the // retries. It comes with ErrCommand. ErrThrottled = errors.New("throttled") )
Functions ¶
Types ¶
type API ¶ added in v0.6.0
type API interface {
// SendMessage sends a message, for Enqueue.
SendMessage(
ctx context.Context,
params *awssqs.SendMessageInput,
optFns ...func(*awssqs.Options),
) (*awssqs.SendMessageOutput, error)
// ReceiveMessage receives messages, for Dequeue.
ReceiveMessage(
ctx context.Context,
params *awssqs.ReceiveMessageInput,
optFns ...func(*awssqs.Options),
) (*awssqs.ReceiveMessageOutput, error)
// DeleteMessage deletes a message, for Ack.
DeleteMessage(
ctx context.Context,
params *awssqs.DeleteMessageInput,
optFns ...func(*awssqs.Options),
) (*awssqs.DeleteMessageOutput, error)
// ChangeMessageVisibility changes a message's visibility timeout, for
// Nack, NackAfter and Extend.
ChangeMessageVisibility(
ctx context.Context,
params *awssqs.ChangeMessageVisibilityInput,
optFns ...func(*awssqs.Options),
) (*awssqs.ChangeMessageVisibilityOutput, error)
// ChangeMessageVisibilityBatch changes the visibility timeout of up to
// ten messages, to make visible again what a Dequeue received but
// does not return.
ChangeMessageVisibilityBatch(
ctx context.Context,
params *awssqs.ChangeMessageVisibilityBatchInput,
optFns ...func(*awssqs.Options),
) (*awssqs.ChangeMessageVisibilityBatchOutput, error)
// GetQueueUrl returns the URL of a queue name.
GetQueueUrl(
ctx context.Context,
params *awssqs.GetQueueUrlInput,
optFns ...func(*awssqs.Options),
) (*awssqs.GetQueueUrlOutput, error)
}
API is the part of the SQS client the store uses. *sqs.Client implements it.
type Config ¶
type Config struct {
// Queue holds the settings.
Queue Settings
}
Config holds the SQS store's configuration, read from the `queue` section.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns the configuration a store starts from before binding: no region, no endpoint, no static credentials, DefaultOpTimeout, DefaultVisibilityTimeout and DefaultMaxRetries.
type Option ¶
type Option func(*Service)
Option configures a Service. Options only record what they are given; Init checks it.
func WithClient ¶
WithClient makes the store send its requests with client, such as an *sqs.Client built elsewhere or a fake, instead of building one, as described in the package documentation. The Region, Endpoint, credential and MaxRetries settings then have no effect. A nil client, or a nil *sqs.Client, makes Init fail with ErrNilClient.
Default: Init builds an *sqs.Client from the settings.
func WithConfig ¶
WithConfig makes Init use a copy of cfg instead of binding the configuration from the ConfigProvider. Init copies *cfg each time it runs and never changes it; the copy is checked against its validate tags as a bound configuration is. A nil cfg makes Init fail with queue.ErrNilConfig.
Default: bind the `queue` section from the ConfigProvider over DefaultConfig.
type Secret ¶ added in v0.6.0
Secret is gas.Secret: a string that is never printed, marshaled or logged, such as Settings.SecretAccessKey. Configuration binds into it as into a string, and string(s) is the value.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is a queue store on Amazon SQS, as described in the package documentation. It is safe for concurrent use.
func (*Service) CheckReady ¶
CheckReady reports readiness without I/O: an error wrapping queue.ErrNotInitialized or queue.ErrClosed when the store is not initialized, the context's error when ctx has ended, and else nil.
func (*Service) Client ¶
Client returns the *sqs.Client the store sends its requests with, or nil when the store is not initialized or was given another API with WithClient, as described in the package documentation.
func (*Service) Close ¶
Close makes every later call but Init return an error wrapping queue.ErrClosed, and waits for every call in flight to return, as described in the package documentation: a Dequeue in flight finishes its receive, makes what it received visible again, and returns queue.ErrClosed. When ctx ends first, Close cancels the requests in flight, whose calls return queue.ErrClosed, and returns an error wrapping ctx's error; the store stays closed. Close then closes the idle connections of a client Init built. A Close that runs at the same time waits for it too. Close on a store that is not initialized returns nil and logs nothing.
func (*Service) Config ¶ added in v0.6.0
Config returns a copy of the configuration the last successful Init resolved, defaults included, or the zero Config before one. A failed Init and Close leave it as it was. Config holds no slice, map or pointer, so the copy shares nothing with the store, and SecretAccessKey and SessionToken stay Secrets.
func (*Service) Dequeue ¶
func (s *Service) Dequeue( ctx context.Context, id string, maxMessages int, wait time.Duration, ) ([]gas.Job, error)
Dequeue receives up to maxMessages messages of the queue, waiting up to wait for the first, with ReceiveMessage, as described in the package documentation. It is bounded by ctx and by wait plus OpTimeout. When Close began before the receive is sent, it sends none; when Close begins before the receive returns, it makes what it received visible again and returns queue.ErrClosed. A reply with more than maxMessages messages, or with a message without an ID or a receipt handle, is an invalid reply, whose valid messages it makes visible again.
func (*Service) Enqueue ¶
func (s *Service) Enqueue( ctx context.Context, id string, payload []byte, opts ...gas.EnqueueOption, ) error
Enqueue sends payload to the queue with opts, with SendMessage, as described in the package documentation.
func (*Service) Extend ¶ added in v0.6.0
Extend keeps the job's message hidden for d more, 0 to 12h, rounded up to a whole second, counted from now, with ChangeMessageVisibility, as described in the package documentation.
func (*Service) Init ¶
Init resolves and checks the configuration, builds the client and retrieves the credentials, as described in the package documentation. On an initialized store it returns queue.ErrAlreadyInitialized and changes nothing. A failed Init leaves the store as it was.
type Settings ¶
type Settings struct {
// Region is the AWS region; empty leaves it to the AWS SDK's default
// chain.
Region string
// Endpoint is the URL requests go to, such as an emulator's; empty is
// the region's SQS endpoint.
Endpoint string
// AccessKeyID is the access key ID of static credentials, used only
// with SecretAccessKey. It is not a secret, but an identifier that
// maps to the AWS account ID, so the store never logs it.
AccessKeyID string
// SecretAccessKey is the secret access key of static credentials,
// used only with AccessKeyID. It prints, marshals and logs as
// `[redacted]`.
SecretAccessKey Secret
// SessionToken is the session token of temporary static credentials.
// It prints, marshals and logs as `[redacted]`.
SessionToken Secret
// OpTimeout bounds each request, and a Dequeue past its wait.
OpTimeout time.Duration `validate:"gt=0"`
// VisibilityTimeout is how long a message Dequeue returns stays
// hidden: 0 is the queue's own, else 1s to 12h.
VisibilityTimeout time.Duration `validate:"min=0,max=12h"`
// MaxRetries is how many times a failed request is retried.
MaxRetries int `validate:"min=0,max=10"`
}
Settings are the SQS store's settings, as described in the package documentation.