Documentation
¶
Overview ¶
Package sqs is the SQS adapter for object-storage events: it polls an SQS queue fed by S3 bucket notifications, parses each message into an objectstorage.Event, and dispatches it through an objectstorage.Router. Application handlers depend on objectstorage, not on this package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type API ¶
type API interface {
ReceiveMessage(context.Context, *sqs.ReceiveMessageInput, ...func(*sqs.Options)) (*sqs.ReceiveMessageOutput, error)
DeleteMessage(context.Context, *sqs.DeleteMessageInput, ...func(*sqs.Options)) (*sqs.DeleteMessageOutput, error)
}
API is the subset of the AWS SQS client the poller depends on. *sqs.Client satisfies it; tests supply a fake so the poll/ack logic is exercised without a live queue.
type Config ¶
type Config struct {
QueueURL string `mapstructure:"queue_url"`
AWSRegion string `mapstructure:"aws_region"`
Key string `mapstructure:"key"` // optional static credential; falls back to the default AWS chain (IRSA) when empty
Secret string `mapstructure:"secret"`
Endpoint string `mapstructure:"endpoint"` // optional custom endpoint (e.g. LocalStack)
MaxMessages int32 `mapstructure:"max_messages"`
WaitTimeSeconds int32 `mapstructure:"wait_time_seconds"`
VisibilityTimeout int32 `mapstructure:"visibility_timeout"`
}
Config carries the SQS connection and polling parameters. The mapstructure tags let a service load it directly from JSON (alias it) instead of redeclaring the schema.
type EventRouter ¶
type EventRouter interface {
Handle(objectstorage2.Event) error
}
EventRouter dispatches a parsed object-storage event to its registered handler. The poller declares the narrow behaviour it needs rather than importing the concrete router, so the composition root owns the binding (the objectstorage.Router satisfies it).