Skip to content

Shuttle/Shuttle.Esb.AmazonSqs

Repository files navigation

Amazon SQS

PM> Install-Package Shuttle.Esb.AmazonSqs

In order to make use of the AmazonSqsQueue you will need access to an Amazon Web Services account. There are some options for local development, such as ElasticMQ, which are beyond the scope of this documentation.

You may also want to take a look at Messaging Using Amazon SQS.

Configuration

The URI structure is amazonsqs://configuration-name/queue-name.

services.AddAmazonSqs(builder =>
{
    var amazonSqsOptions = new AmazonSqsOptions
    {
        ServiceUrl = "http://localhost:9324",
        MaxMessages = 1,
        WaitTime = TimeSpan.FromSeconds(20)
    };

    amazonSqsOptions.Configure += (sender, args) =>
    {
        Console.WriteLine($"[event] : Configure / Uri = '{((IQueue)sender).Uri}'");
    };

    builder.AddOptions("local", amazonSqsOptions);
});

The Configure event args arugment exposes the AmazonSQSConfig directly for any specific options that need to be set.

The default JSON settings structure is as follows:

{
  "Shuttle": {
    "AmazonSqs": {
      "local": {
        "ServiceUrl": "http://localhost:9324",
        "MaxMessages": 5,
        "WaitTime": "00:00:20"
      },
      "proper": {
        "ServiceUrl": "https://sqs.us-east-2.amazonaws.com/123456789012/MyQueue"
      }
    }
  }
}

Options

Option Default Description
ServiceUrl The URL to connect to.
MaxMessages 10 Specifies the number of messages to fetch from the queue.
WaitTime 00:00:20 Specifies the TimeSpan duration to perform long-polling.

About

Amazon SQS implementation for use with Shuttle.Esb.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages