sqs

package
v0.17.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: AGPL-3.0 Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(ctx context.Context, t driver.Target, password string, dial queuex.DialFunc, timeout time.Duration, clientID string) (queuex.Queue, error)

Open logs in with the access key ID in the conn's URL and the secret key from its password reference.

func OpenKeys

func OpenKeys(ctx context.Context, t driver.Target, k Keys, dial queuex.DialFunc, timeout time.Duration, clientID string) (queuex.Queue, error)

OpenKeys connects with the given keys through dial (direct, --via an SSH server, or a VPN) and checks that SQS answers and takes them.

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) Close

func (s *SQS) Close()

Close ends the idle connections.

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

func (s *SQS) Delete(ctx context.Context, queues []string, dryRun bool) ([]queuex.Deleted, error)

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

func (s *SQS) Describe(ctx context.Context, name string) (*queuex.TopicDetail, error)

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) Groups

func (s *SQS) Groups(context.Context) ([]queuex.Group, error)

Groups: SQS has no consumer groups.

func (*SQS) Info

func (s *SQS) Info(ctx context.Context) (*queuex.Info, error)

Info is the region at a glance: where komando talks to, whose queues they are, and how many.

func (*SQS) Lag

func (s *SQS) Lag(context.Context, string) (*queuex.GroupLag, error)

Lag: SQS has no consumer groups.

func (*SQS) Peek

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

func (s *SQS) Purge(ctx context.Context, queue string, dryRun bool) (*queuex.Purged, error)

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

func (s *SQS) Send(ctx context.Context, m queuex.Message, dryRun bool) (*queuex.Sent, error)

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.

func (*SQS) Topics

func (s *SQS) Topics(ctx context.Context, pattern string, internal bool, limit int) ([]queuex.Topic, error)

Topics lists the queues whose name matches pattern (shell style: orders-*), with their message counts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL