Documentation ¶
Overview ¶
Package sqs provides default implementations for using AWS SQS with the runtimes in the queue package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchDeleteProcessor ¶
type BatchDeleteProcessor struct {
// contains filtered or unexported fields
}
BatchDeleteProcessor will concurrently process and delete messages from AWS SQS.
func NewBatchDeleteProcessor ¶
func NewBatchDeleteProcessor(opts ...BatchDeleteProcessorOption) *BatchDeleteProcessor
NewBatchDeleteProcessor returns a fully initially BatchDeleteProcessor.
func (*BatchDeleteProcessor) Process ¶
Process implements the queue.Processor interface.
Each message is processed concurrently using the processor that was provided to the BatchDeleteProcessor when it was created. If the inner processor returns an error for a message, it will not be deleted from SQS and will be reprocessed after the VisibilityTimeout expires. If no error is returned, the message will be collected with the other messages from the slice, msgs, to be deleted together in a single BatchDelete request to SQS.
type BatchDeleteProcessorOption ¶
type BatchDeleteProcessorOption interface {
// contains filtered or unexported methods
}
BatchDeleteProcessorOption are options for configuring the BatchDeleteProcessor.
type CommonOption ¶
type CommonOption interface { ConsumerOption BatchDeleteProcessorOption }
CommonOption are options common to all AWS SQS related consumers and processors.
func LogHandler ¶
func LogHandler(h slog.Handler) CommonOption
LogHandler configures the underlying slog.Handler.
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
Consumer consumes messages from AWS SQS.
func NewConsumer ¶
func NewConsumer(opts ...ConsumerOption) *Consumer
NewConsumer returns a fully initialized Consumer.
func (*Consumer) Consume ¶
Consume implements the queue.Consumer interface.
A ReceiveMessage request is sent to AWS SQS with the configured options (e.g. visibility timeout, wait time seconds, etc.). An error is only returned in the case where the SQS request fails or SQS returns zero messages. In the case of zero messages, the error, queue.ErrNoItem, is returned which allows the queue based runtimes to disregard this as a failure and retry consuming messages.
type ConsumerOption ¶
type ConsumerOption interface {
// contains filtered or unexported methods
}
ConsumerOption are options for configuring the Consumer.
func MaxNumOfMessages ¶
func MaxNumOfMessages(n int32) ConsumerOption
MaxNumOfMessages defines the maximum number of messages which Amazon SQS will return in a single response.
Amazon SQS never returns more messages than this value (however, fewer messages might be returned). The minimum is 1. The maximum is 10.
func VisibilityTimeout ¶
func VisibilityTimeout(n int32) ConsumerOption
VisibilityTimeout a period of time during which Amazon SQS prevents all consumers from receiving and processing the message.
The default visibility timeout for a message is 30 seconds. The minimum is 0 seconds. The maximum is 12 hours.
func WaitTimeSeconds ¶
func WaitTimeSeconds(n int32) ConsumerOption
WaitTimeSeconds is the duration (in seconds) for which the call waits for a message to arrive in the queue before returning. If a message is available, the call returns sooner than WaitTimeSeconds. If no messages are available and the wait time expires, the call returns successfully with an empty list of messages. To avoid HTTP errors, ensure that the HTTP response timeout for ReceiveMessage requests is longer than the WaitTimeSeconds parameter.