Skip to content

Amazon SQS channel binding

There are three likely scenarios for use of the Channel Binding Object:

  • One file defines both publish and subscribe operations, for example if we were implementing the work queue pattern to offload work from an HTTP API endpoint to a worker process. In this case the channel would be defined on the Channel Object in that single file.
  • The producer and consumer both have an AsyncAPI specification file, and the producer is raising an event, for example interop between microservices, and the producer 'owns' the channel definition and thus has the SQS Binding on its Channel Object.
  • The producer and consumer both have an AsyncAPI specification file, and the consumer receives commands, for example interop between microservices, and the consumer 'owns' the channel definition and thus has the SQS Binding on its Channel Object.

An SQS queue can set up a Dead Letter Queue as part of a Redelivery Policy. To support this requirement, the Channel Binding Object allows you to define both a Queue Object to use as the Channel or target in a publish Operation and a Dead Letter Queue. You can then refer to the Dead letter Queue in the Redrive Policy using the Identifier Object and setting the name field to match the name field of your Dead Letter Queue Object. (If you define the DLQ externally, the Identifier also supports an ARN).

Structure

copy

Examples

json
{
    "queue": {
        "name": "myQueue",
        "fifoQueue": true,
        "deduplicationScope": "messageGroup",
        "fifoThroughputLimit": "perMessageGroupId",
        "deliveryDelay": 15,
        "visibilityTimeout": 60,
        "receiveMessageWaitTime": 0,
        "messageRetentionPeriod": 86400,
        "redrivePolicy": {
            "deadLetterQueue": {
                "arn": "arn:aws:SQS:eu-west-1:0000000:123456789"
            },
            "maxReceiveCount": 15
        },
        "policy": {
            "statements": [
                {
                    "effect": "Deny",
                    "principal": "arn:aws:iam::123456789012:user/dec.kolakowski",
                    "action": [
                        "sqs:SendMessage",
                        "sqs:ReceiveMessage"
                    ]
                }
            ]
        },
        "tags": {
            "owner": "AsyncAPI.NET",
            "platform": "AsyncAPIOrg"
        }
    },
    "deadLetterQueue": {
        "name": "myQueue_error",
        "deliveryDelay": 0,
        "visibilityTimeout": 0,
        "receiveMessageWaitTime": 0,
        "messageRetentionPeriod": 604800
    }
}

Changelog

Added

(queue | deadLetterQueue).policy.statements.resource

The resource(s) that this policy applies to.

json
{ 
  "resource": { 
      "description": "The resource(s) that this policy applies to.", 
      "oneOf": [ 
        { 
          "type": "string"
        }, 
        { 
          "type": "array", 
          "items": { 
              "type": "string"
          } 
        } 
      ] 
    } 
} 

(queue | deadLetterQueue).policy.statements.condition

Specific circumstances under which the policy grants permission

json
{
  "condition": { 
    "description": "Specific circumstances under which the policy grants permission", 
    "type": "object", 
    "patternProperties": { 
      ".*": { 
        "type": "object", 
        "patternProperties": { 
          ".*": { 
            "oneOf": [ 
              { 
                "type": "string"
              }, 
              { 
                "type": "array", 
                "items": { 
                  "type": "string"
                } 
              } 
            ] 
          } 
        } 
      } 
    } 
  } 
}

Changed

(queue | deadLetterQueue).policy.statements.principal

The AWS account(s) or resource ARN(s) that this statement applies to.

json
{
  "principal": {
    "description": "The AWS account(s) or resource ARN(s) that this statement applies to.",
    "oneOf": [
      {
        "type": "string"
      },
      { 
        "type": "object", 
        "properties": { 
          "AWS": { 
            "oneOf": [ 
              { 
                "type": "string"
              }, 
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ] 
          } 
        }, 
        "required": [ 
          "AWS"
        ], 
        "additionalProperties": false
      }, 
      { 
        "type": "object", 
        "properties": { 
          "Service": { 
            "oneOf": [ 
              { 
                "type": "string"
              }, 
              { 
                "type": "array", 
                "items": { 
                  "type": "string"
                } 
              } 
            ] 
          } 
        }, 
        "required": [ 
          "Service"
        ], 
        "additionalProperties": false
      }
    ]
  }
}