Documentation
¶
Overview ¶
Package sqs is the Amazon SQS engine of `komando queue`. It speaks the SQS JSON API over HTTPS itself, signed with the AWS SDK's SigV4 signer (already part of komando for its other AWS clients), so no SQS SDK or aws CLI is needed. It registers itself with queuex for sqs:// conns that carry their own keys; conns that log in with an AWS profile (SSO, roles) are opened by the CLI with OpenKeys. Reading never removes or hides a message: peek receives with a visibility timeout of 0 and never deletes. See docs/features/queues.md.
Index ¶
- func Open(ctx context.Context, t driver.Target, password string, dial queuex.DialFunc, ...) (queuex.Queue, error)
- func OpenKeys(ctx context.Context, t driver.Target, k Keys, dial queuex.DialFunc, ...) (queuex.Queue, error)
- type Keys
- type SQS
- func (s *SQS) Close()
- func (s *SQS) Create(ctx context.Context, sp queuex.TopicSpec, dryRun bool) (*queuex.Created, error)
- func (s *SQS) Delete(ctx context.Context, queues []string, dryRun bool) ([]queuex.Deleted, error)
- func (s *SQS) Describe(ctx context.Context, name string) (*queuex.TopicDetail, error)
- func (s *SQS) Groups(context.Context) ([]queuex.Group, error)
- func (s *SQS) Info(ctx context.Context) (*queuex.Info, error)
- func (s *SQS) Lag(context.Context, string) (*queuex.GroupLag, error)
- func (s *SQS) Peek(ctx context.Context, o queuex.PeekOptions) (*queuex.PeekResult, error)
- func (s *SQS) Purge(ctx context.Context, queue string, dryRun bool) (*queuex.Purged, error)
- func (s *SQS) Send(ctx context.Context, m queuex.Message, dryRun bool) (*queuex.Sent, error)
- func (s *SQS) Topics(ctx context.Context, pattern string, internal bool, limit int) ([]queuex.Topic, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Keys ¶
type Keys struct {
ID, Secret, Token string
}
Keys are AWS credentials: an access key ID, its secret, and the session token of temporary keys (SSO, an assumed role).
type SQS ¶
type SQS struct {
// contains filtered or unexported fields
}
SQS is a queuex.Queue on one region of an AWS account.
func (*SQS) Create ¶
func (s *SQS) Create(ctx context.Context, sp queuex.TopicSpec, dryRun bool) (*queuex.Created, error)
Create makes a queue: a FIFO queue when its name ends in .fifo. SQS would answer a second create with the same settings by giving the queue that is there, so komando checks first and says QUEUE_EXISTS. A dry run checks the name and the settings komando knows, and makes nothing: SQS cannot check a queue without making it.
func (*SQS) Delete ¶
Delete deletes queues and every message in them. Every name must exist; with dry run it only says what each holds. SQS takes up to 60 seconds to finish a delete, and only then can a queue of the same name be made.
func (*SQS) Describe ¶
Describe shows one queue: its counts, its settings, its dead-letter queue and the queues that use it as theirs, and its tags.
func (*SQS) Info ¶
Info is the region at a glance: where komando talks to, whose queues they are, and how many.
func (*SQS) Peek ¶
func (s *SQS) Peek(ctx context.Context, o queuex.PeekOptions) (*queuex.PeekResult, error)
Peek receives up to o.Limit messages with a visibility timeout of 0 and never deletes them: SQS keeps every message, and consumers can receive them again at once (nothing is hidden from them). SQS gives messages in no set order (a FIFO queue: in order within a message group), so peek shows a sample of what is waiting, not the newest or the oldest.
Every receive counts: SQS raises the message's receive count, and a queue with a dead-letter queue moves a message there after maxReceiveCount receives. So peek refuses a queue whose limit is too low to spare one, and stops with DELIVERY_LIMIT_NEAR once a message it showed has fewer than keepReceives receives left.
func (*SQS) Purge ¶
Purge deletes every message in a queue, also those a consumer received and has not deleted yet (in flight), and keeps the queue. SQS allows one purge per queue every 60 seconds and may take that long to finish.
func (*SQS) Send ¶
Send sends one message to a queue. Headers become string message attributes. A FIFO queue needs --key, the message group: messages of one group are received in order. Its deduplication ID is the body's hash when the queue says so (ContentBasedDeduplication), otherwise a new random one, so sending the same text twice gives two messages.