LiteBus
CatalogTransport

AWS SQS Transport

  • ID: transport.aws-sqs
  • Name: AWS SQS transport
  • Maturity: Beta
  • Summary: Amazon SQS adapter with long-poll consume, visibility-timeout requeue, and canonical header mapping.

What It Does

AwsSqsTransportModule composes SqsPublisher and SqsConsumer on Amazon.SQS. Publish targets queue URL in Destination; Route is stored as message attribute because SQS has no routing-key concept.

SqsConsumer reads ApproximateReceiveCount and uses SqsRequeueBackoff to calculate visibility timeout when handlers call ReturnToQueueAsync.

Beta tier note: this adapter is production-oriented but remains Beta while the project keeps broader broker soak coverage focused on AMQP.

Public Surface

Registration and Runtime Types

APIRole
AwsSqsTransportModuleRegisters SQS transport services
SqsPublisher.PublishAsyncCalls SendMessage
SqsConsumer.StartAsyncRuns long-poll receive loop
SqsMessageMapperMaps request and received message attributes
SqsRequeueBackoffComputes visibility timeout and poll backoff
AwsSqsConnectivityDiagnosticCheckReads one queue ARN for host readiness
LiteBusTransportAwsTelemetry.MeterNameReserved SQS meter name

Options

PropertyDefaultPurpose
RegionnullAWS region
ServiceUrlnullLocalStack or custom endpoint
AccessKeynullExplicit credential key
SecretKeynullExplicit credential secret
ConnectivityCheckQueueUrlnullQueue URL read by the readiness probe; missing reports degraded
LongPollWaitTimeSeconds20Long-poll interval
VisibilityTimeoutSeconds30Receive visibility timeout
RequeueVisibilityTimeoutSeconds30Base requeue timeout
MaxRequeueVisibilityTimeoutSeconds900Max requeue timeout
RequeueBackoffMultiplier2.0Requeue timeout backoff multiplier
PollBackoffInitial500msBatch failure poll delay
PollBackoffMax30sMax poll delay
PollBackoffMultiplier2.0Poll backoff multiplier

Ack Mapping

Transport callSQS action
AcceptAsyncDeleteMessage
DiscardAsyncDeleteMessage
ReturnToQueueAsyncChangeMessageVisibility with computed timeout

Packages

  • LiteBus.Transport.AwsSqs

Requires

  • transport.publish-consume-contracts
  • transport.manual-acknowledgement
  • transport.single-broker-registration
  • SQS queue URL and AWS credentials or LocalStack endpoint

Invariants

  • One transport broker adapter per process.
  • Binary body payloads are base64 encoded with litebus-content-encoding=base64.
  • Redelivery hint uses ApproximateReceiveCount > 1.

Non-Goals

  • SNS topology management.
  • Automatic FIFO and dedup policy management.
  • Cross-account IAM and queue policy automation.

Observability

Metrics

ItemValue
Shared meterLiteBus.Transport
Broker taglitebus.transport.broker="sqs"
Shared gaugeslitebus.transport.circuit_breaker.open, litebus.transport.circuit_breaker.failure_count
Reserved adapter meterLiteBus.Transport.AwsSqs
OpenTelemetry registrationAddLiteBusTransportMetrics()

Tracing

  • Activity source LiteBus.Transport
  • Spans send {destination} and process {destination} with messaging.system=aws_sqs

Diagnostics

  • Diagnostic check id: transport.sqs.connectivity
  • The probe requests only QueueArn from ConnectivityCheckQueueUrl through GetQueueAttributes.
  • Grant sqs:GetQueueAttributes on the target queue. Missing target configuration reports degraded.
  • See the AWS SDK for .NET v4 SQS client contract.

Test Coverage

Covered

Test methodProject
Build_ShouldRegisterTransportServicesLiteBus.Transport.UnitTests (AwsSqs/)
Build_SecondTransportModule_ShouldThrowLiteBus.Transport.UnitTests (AwsSqs/)
CheckAsync_WithoutQueueUrl_ShouldReturnDegradedLiteBus.Transport.UnitTests (AwsSqs/)
ToSendMessageRequest_ShouldMapBodyAndHeadersLiteBus.Transport.UnitTests (AwsSqs/)
ToSendMessageRequest_WithBinaryBody_ShouldBase64EncodeLiteBus.Transport.UnitTests (AwsSqs/)
ToTransportMessage_WithBase64Body_ShouldDecodeBytesLiteBus.Transport.UnitTests (AwsSqs/)
ComputeRequeueVisibilityTimeout_shouldHonorReceiveCountLiteBus.Transport.UnitTests (AwsSqs/)
PublishThroughSqs_ShouldAcceptProcessAndDispatchCommandLiteBus.Durable.IntegrationTests (Ingress/AwsSqs/)
PublishThroughSqs_ShouldAcceptProcessAndDispatchCommand readiness assertionLiteBus.Durable.IntegrationTests (Ingress/AwsSqs/)
RequeueEnabled_WithTransientStoreFailure_ShouldEventuallyAcceptLiteBus.Durable.IntegrationTests (Ingress/AwsSqs/)
ProcessPendingAsync_ShouldPublishEnvelopeToSqsQueueLiteBus.Durable.IntegrationTests (Dispatch/Outbox/AwsSqs/)
ProcessPendingAsync_WhenCircuitBreakerOpen_ShouldNotPublishLiteBus.Durable.IntegrationTests (Dispatch/Outbox/AwsSqs/)

Untested

  • Raw SQS publisher and consumer integration without durable wrappers.
  • Gauge export assertions for broker tag sqs.
  • Live AWS (non-LocalStack) end-to-end broker tests in this repo.

Out-of-Scope

  • SNS fan-out orchestration.
  • Cross-account queue policy automation.

Deep Docs

On this page