Skip to content
On this page

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 which are beyond the scope of this documentation.

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

Configuration

The queue configuration is part of the specified uri, e.g.:

<inbox
    workQueueUri="amazonsqs://endpoint-name/queue-name?maxMessages=15&amp;waitTimeSeconds=20"
    .
    .
    .
/>
Segment / ArgumentDefaultDescription
endpoint-namerequiredWill be resolved by an IAmazonSqsConfiguration implementation (see below).
queue-namerequiredThe name of queue to connect to.
maxMessages1Specifies the number of messages to fetch from the queue.
waitTimeSeconds20Specifies the number of seconds to perform the long-polling.

IAmazonSqsConfiguration

AmazonSQSConfig GetConfiguration(string endpointName);

The GetConfiguration() method should return the Amazon.SQS.AmazonSQSConfig instance that will be used by the AmazonSQSClient to interact with the relevant Amazon SQS queue.

The relevant IAmazonSqsConfiguration should be registered with the IComponentRegistry:

IComponentResolver.Register<IAmazonSqsConfiguration, DefaultAmazonSqsConfiguration>;

DefaultAmazonSqsConfiguration

This implementation will add all the endpoints provided in the application configuration file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <section name="amazonsqs" type="Shuttle.Esb.AmazonSqs.AmazonSqsSection, Shuttle.Esb.AmazonSqs"/>
    </configSections>

    <amazonsqs>
        <endpoints>
            <endpoint name="endpoint-a" serviceUrl="https://sqs.us-east-1.amazonaws.com/123456789012" />
            <endpoint name="endpoint-b" serviceUrl="https://sqs.us-east-2.amazonaws.com/123456789012" />
        </endpoints>
    </amazonsqs>
</configuration>

<inbox
    workQueueUri="amazonsqs://endpoint-a/server-inbox-work-queue"
    .
    .
    .
/>
Amazon SQS has loaded