Amazon SQS Transport

Project Hosting
NuGet Package NServiceBus.AmazonSQS (1.x)
Target NServiceBus Version: 5.x

Simple Queue Service (SQS) is a message queue service provided by Amazon Web Services.

Advantages and Disadvantages

Advantages

  • Fully managed turn-key messaging infrastructure. SQS queues requires very little effort to set up, maintain and manage over time.
  • Integrates seamlessly with other services provided by AWS, for example, IAM, CloudWatch, Lambda, etc. For organizations already committed to AWS, SQS is a natural choice.
  • Can be used as a gateway between endpoints that may not have direct connectivity to each-other.

Disadvantages

  • Like other message brokers, there is no local store-and-forward mechanism available. If an endpoint cannot reach SQS, either due to network problems or if SQS is unavailable, the endpoint will not be able to send nor receive messages.
  • Can be relatively expensive when using larger volumes of messages.

Getting Started

Set Up An AWS Account

An AWS IAM account with a pair of Access Keys is required.

The IAM account requires the following:

SQS permissions

  • CreateQueue
  • DeleteMessage
  • DeleteMessageBatch
  • GetQueueUrl
  • ReceiveMessage
  • SendMessage
  • SendMessageBatch
  • SetQueueAttributes
  • ChangeMessageVisibility
  • ChangeMessageVisibilityBatch
  • PurgeQueue

S3 permissions

  • CreateBucket
  • DeleteObject
  • GetObject
  • PutObject
  • PutLifecycleConfiguration
  • GetLifecycleConfiguration
  • ListAllMyBuckets

By default, AWS Access Key ID and AWS Secret Access Key are discovered from environment variables of the machine that is running the endpoint:

  • Access Key ID goes in AWS_ACCESS_KEY_ID
  • Secret Access Key goes in AWS_SECRET_ACCESS_KEY
var transport = busConfiguration.UseTransport<SqsTransport>();
transport.ConnectionString("Region=ap-southeast-2;S3BucketForLargeMessages=myBucketName;S3KeyPrefix=my/key/prefix;");

Related Articles

  • Configuration Options
    Configuration options for the SQS transport.
  • Scripting
    Example code and scripts to facilitate deployment and operational actions against the SQS Transport.
  • Topology
    Identify the physical components used by the transport and how they interact.
  • Transaction Support
    Explore the transaction modes the transport supports.
  • Why Use SQS?
    Explore when it makes sense to use SQS as a transport.

Last modified