Class SqsTransport

All Implemented Interfaces:
Closeable, AutoCloseable

public final class SqsTransport extends PollingTransport

Messaging over Amazon SQS, signed with the backend's own SigV4 signer and no AWS SDK.

cn1.messaging.url=sqs://eu-west-1

The host part is a region, which addresses sqs.<region>.amazonaws.com, or a host:port endpoint for a compatible service (ElasticMQ, LocalStack), whose region comes from cn1.messaging.sqs.region (default us-east-1). Only an endpoint on loopback is spoken to over plain HTTP. Credentials are resolved the way Credentials.resolve() documents: the environment, then the container, then the instance metadata service.

A destination is a standard queue, created on first use. SQS allows letters, digits, - and _ in a queue name, so every other character of a destination -- the . of orders.dlq -- becomes -. Listeners of one queue compete for its messages whatever their group: SQS has no consumer groups, and fan-out is SNS's job.

The body is sent base64 encoded, so any payload survives; the key and headers travel in one message attribute, cn1-headers, which keeps clear of SQS's limit of ten attributes. A message from a producer that is not this transport is read as it is: its body as UTF-8 text and its string attributes as headers. SQS limits a message to 256 KiB, which the encoding makes about 190 KiB of payload.

A message is handed to one consumer for cn1.messaging.lease milliseconds (SQS's visibility timeout); one not settled in that time is delivered again. A failed message is not copied: its visibility is pushed back by the retry delay, and SQS's own receive count is its attempt number. A delay is at most twelve hours, SQS's limit.