Amazon SQS Transport

Project Hosting
NuGet Package NServiceBus.AmazonSQS (2.x) | License
This is a community run project. License and support are independent of Particular Software.
Target NServiceBus Version: 6.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

To use NServiceBus.AmazonSQS, an AWS IAM account with a pair of Access Keys is required.

The IAM account requires the following SQS permissions and S3 permissions:

  • sqs::CreateQueue
  • sqs::DeleteMessage
  • sqs::GetQueueUrl
  • sqs::ReceiveMessage
  • sqs::SendMessage
  • sqs::SetQueueAttributes
  • sqs::ChangeMessageVisibility
  • sqs::PurgeQueue
  • s3::CreateBucket
  • s3::DeleteObject
  • s3::GetObject
  • s3::PutObject
  • s3::PutLifecycleConfiguration
  • s3::GetLifecycleConfiguration
  • s3::ListAllMyBuckets

By default, Access Key ID and 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 = endpointConfiguration.UseTransport<SqsTransport>();
transport.Region("ap-southeast-2");
transport.S3BucketForLargeMessages("myBucketName", "my/key/prefix");

Related Articles


Last modified