diff --git a/CODEOWNERS b/CODEOWNERS
index 3ba67600..b97cdeea 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -15,4 +15,6 @@
/googlepubsub/ @whitlockjc
/solace/ @damaru-inc @CameronRushton
/pulsar/ @VisualBean
+/sns/ @dpwdec @iancooper
+/sqs/ @dpwdec @iancooper
*.json @KhudaDad414
diff --git a/sns/README.md b/sns/README.md
index 6a0f81d9..26a78576 100644
--- a/sns/README.md
+++ b/sns/README.md
@@ -15,23 +15,288 @@ Current version is `0.1.0`.
This object MUST NOT contain any properties. Its name is reserved for future use.
-
-
## Channel Binding Object
-This object MUST NOT contain any properties. Its name is reserved for future use.
+This object contains information about the channel representation in SNS.
+
+We represent an AsyncAPI Channel with a Topic in SNS. The bindings here allow definition of a topic within SNS. We provide properties on the binding that allow creation of a topic in infrastructure-as-code scenarios. Be aware that although the binding offers that flexibility, it may be more maintainable to specify properties such as SNS Access Control Policy outside of AsyncAPI.
+
+SNS supports many optional properties. To mark a channel as SNS, but use default values for the channel properties, just use an empty object {}.
+
+### Fields
+
+|Field Name | Type | Description|
+|---|:---:|---|
+| `name` | string | **Required.** The name of the topic. Can be different from the channel name to allow flexibility around AWS resource naming limitations.|
+| `ordering` | [ordering](#ordering)| **Optional.** By default, we assume an unordered SNS topic. This field allows configuration of a FIFO SNS Topic. |
+| `policy` |[policy](#policy) | **Optional.** The security policy for the SNS Topic |
+| `tags` |Object | **Optional.** Key-value pairs that represent AWS tags on the topic. |
+|`bindingVersion` | string | **Optional**, defaults to `latest`. The version of this binding.|
+
+### Schemas
+
+#### Ordering
+|Field Name | Type | Description|
+|---|:---:|---|
+| `type` | string | **Required.** Defines the type of SNS Topic. Can be either `standard` or `FIFO`. |
+| `contentBasedDeduplication` | boolean | **Optional.** Whether the de-duplication of messages should be turned on. Defaults to `false`|
+
+#### Policy
+|Field Name | Type | Description|
+|---|:---:|---|
+| `statements` | [[Statement](#statement)] | **Required.** An array of Statement objects, each of which controls a permission for this topic |
+
+#### Statement
+|Field Name | Type | Description|
+|---|:---:|---|
+| `effect` | string |**Required.** Either "Allow" or "Deny"|
+| `principal` | string or array of string |**Required.** The AWS account or resource ARN that this statement applies to|
+| `action` | string or array of string |**Required.** The SNS permission being allowed or denied e.g. sns:Publish|
+
+##### Examples
+Just use defaults
+```yaml
+channels:
+ user-signedup:
+ description: A user has signed up to our service
+ bindings:
+ sns: {}
+```
+
+Minimal definition, just policy
+
+```yaml
+channels:
+ user-signedup:
+ description: A user has signed up to our service
+ bindings:
+ sns:
+ policy:
+ statements:
+ - effect : Allow
+ principal: *
+ action: SNS:Publish
+```
## Operation Binding Object
-This object MUST NOT contain any properties. Its name is reserved for future use.
+This object contains information operation binding in SNS.
+
+We represent SNS producers via a **subscribe** Operation Object. In simple cases this may not require configuration, and can be shown as an empty SNS Binding Object i.e. {} if you need to explicitly indicate how a producer publishes to the channel.
+
+We represent SNS consumers via a **publish** Operation Object. These consumers need an SNS Subscription that defines how they consume from SNS i.e. the protocol that they use, and any filters applied.
+
+The SNS binding does not describe the receiver.If you wish to define the receiver, add a **publish** Operation Binding Object for that receiver. For example, if you send message to an SQS queue from an SNS Topic, you would add a protocol of 'sqs' and an Identifier object for the queue. That identifier could be an ARN of a queue defined outside of the scope of AsyncAPI, but if you wanted to define the receiver you would use the name of a queue defined in an SQS Binding on the **publish** Operation Binding Object.
+
+We support an array of consumers via the **consumers** field. This allows you to represent multiple protocols consuming an SNS Topic in one file. You may also use it for multiple consumers with the same protocol, instead of representing each consumer in a separate file.
+
+### Fields
+
+| Field Name | Type | Applies To | Description |
+|---|:---:|:---:|---|
+| `topic` | [identifier](#identifier) |Publish, Subscribe| **Optional.** Often we can assume that the SNS Topic is the channel name-we provide this field in case the you need to supply the ARN, or the Topic name is not the channel name in the AsyncAPI document.|
+| `consumers` | [[Consumer](#consumer)] |Publish| **Required.** The protocols that listen to this topic and their endpoints.|
+| `deliveryPolicy` | [deliveryPolicy](#delivery-policy) |Subscribe| **Optional.** Policy for retries to HTTP. The field is the default for HTTP receivers of the [SNS Topic](https://docs.aws.amazon.com/sns/latest/api/API_CreateTopic.html) which may be overridden by a specific consumer.|
+|`bindingVersion` | string |Publish, Subscribe| **Optional**, defaults to `latest`. The version of this binding.|
+
+### Schemas
+
+#### Consumer
+
+| Field Name | Type | Description |
+|---|:---:|---|
+| `protocol` | string | **Required.** The protocol that this endpoint receives messages by. Can be `http`, `https`, `email`, `email-json`, `sms`, `sqs`, `application`, `lambda` or `firehose` |
+| `endpoint` |[identifier](#identifier)| **Required.** The endpoint messages are delivered to. |
+| `filterPolicy` | [filterPolicy](#filter-policy) | **Optional.** Only receive a subset of messages from the channel, determined by this policy. |
+| `rawMessageDelivery` | boolean | **Required.** If *true* AWS SNS attributes are removed from the body, and for SQS, SNS message attributes are copied to SQS message attributes. If *false* the SNS attributes are included in the body. |
+| `redrivePolicy` | [redrivePolicy](#redrive-policy) | **Optional.** Prevent poison pill messages by moving un-processable messages to an SQS dead letter queue. |
+| `deliveryPolicy` | [deliveryPolicy](#delivery-policy) | **Optional.** Policy for retries to HTTP. The parameter is for that [SNS Subscription](https://docs.aws.amazon.com/sns/latest/api/API_Subscribe.html) and overrides any policy on the [SNS Topic](https://docs.aws.amazon.com/sns/latest/api/API_CreateTopic.html). |
+| `displayName` | string |**Optional.** The display name to use with an SMS subscription |
+
+
+#### Delivery Policy
+|Field Name | Type | Description|
+|---|:---:|---|
+| `minDelayTarget` | integer | **Optional.** The minimum delay for a retry in seconds |
+| `maxDelayTarget` | integer | **Optional.** The maximum delay for a retry in seconds |
+| `numRetries` | integer | **Optional.** The total number of retries, including immediate, pre-backoff, backoff, and post-backoff retries |
+| `numNoDelayRetries` | integer | **Optional.** The number of immediate retries (with no delay) |
+| `numMinDelayRetries` | integer | **Optional.** The number of immediate retries (with delay) |
+| `numMaxDelayRetries` | integer | **Optional.** The number of post-backoff phase retries, with the maximum delay between retries |
+| `backoffFunction` | string, one of: arithmetic, exponential, geometric or linear | **Optional.** The algorithm for backoff between retries |
+| `maxReceivesPerSecond` | integer | **Optional.** The maximum number of deliveries per second, per subscription |
+
+#### Filter Policy
+|Field Name | Type | Description|
+|---|:---:|---|
+| `attributes` |Map(string, array or string or object) | **Required.** A map of a message attribute to an array of possible matches. The match may be a simple string for an exact match, but it may also be an object that represents a constraint and values for that constraint |
+
+#### Identifier
+|Field Name | Type | Description|
+|---|:---:|---|
+|`url` |string| **Optional.** The endpoint is a URL |
+|`email` |string| **Optional.** The endpoint is an email address |
+|`phone` |string| **Optional.** The endpoint is a phone number|
+|`arn` |string| **Optional.** The target is an [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). For example, for SQS, the identifier may be an ARN, which will be of the form: ["arn:aws:sqs:{region}:{account-id}:{queueName}"](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)|
+|`name` |string| **Optional.** The endpoint is identified by a name, which corresponds to an identifying field called 'name' of a binding for that protocol on this **publish** Operation Object. For example, if the protocol is 'sqs' then the name refers to the name field **sqs** binding. We don't use $ref because we are referring, not including. |
+
+We provide an Identifer Object to support providing the identifier of an externally defined endpoint for this SNS *publication* to target, or an endpoint on another binding against this Operation Object (via the name field).
+
+#### Redrive Policy
+
+|Field Name | Type | Description|
+|---|:---:|---|
+| `deadLetterQueue` |[Identifier](#identifier)| **Required.** The SQS queue to use as a dead letter queue (DLQ). Note that you may have a Redrive Policy to put messages that cannot be delivered to an SQS queue, even if you use another protocol to consume messages from the queue, so it is defined at the level of the SNS Operation Binding Object in a Consumer Object (and is applied as part of an [SNS Subscription](https://docs.aws.amazon.com/sns/latest/dg/sns-create-subscribe-endpoint-to-topic.html)). The SQS Binding describes how to define an SQS Binding that supports defining the target SQS of the Redrive Policy. |
+| `maxReceiveCount` |integer| **Optional.** The number of times a message is delivered to the source queue before being moved to the dead-letter queue. Defaults to 10. |
+
+### Examples
+
+#### SNS to SQS Pub-Sub
+
+[](SNS-SQS-Pub-Sub.png)
+
+We are producing to an SNS channel
+
+```yaml
+channels:
+ user-signedup:
+ description: A user has signed up for our service
+ binding :
+ sns: {} # Indicates that the channel is an SNS Topic
+ subscribe:
+ operationId: sendMessage
+ description: send messages to the topic
+ bindings:
+ sns:
+ consumers:
+ - protocol: sqs
+ endpoint:
+ name: myQueue
+ rawMessageDelivery: false
+```
+
+We are consuming an SNS channel, using an SQS queue. A separate file specifies the producer, and has the SNS Bindings for the channel. For this reason we do not repeat the SNS binding information for the channel here, to avoid duplicated definitions diverging. Instead we just define the **publish** Operation Binding.
+
+In this version, the SQS queue is defined elsewhere, and we just reference via its ARN. It is worth noting that this couples the specification to the AWS *region* and *account*, which are part of the ARN, and if we moved the queue to a new region or account was this specification would need to be updated to reflect that.
+
+
+```yaml
+channels:
+ user-signedup:
+ description: A user has signed up for our service
+ publish:
+ operationId: receiveMessage
+ description: receive messages from the topic
+ bindings:
+ sns:
+ consumers:
+ - protocol: sqs
+ endpoint:
+ arn: arn:aws:sqs:us-west-2:123456789012:UserSignedUpQueue
+ rawMessageDelivery: true
+```
+
+We are consuming an SNS channel, using an SQS queue. A separate file specifies the producer, and has the SNS Bindings for the channel. For this reason we do not repeat the SNS binding information for the channel here, to avoid duplicated definitions diverging. Instead we just define the **publish** Operation Binding.
+
+In this version, the SQS queue is defined in this file, and we reference it by name. For brevity that definition is not shown here. See the SQS Binding Object for more.
+
+```yaml
+channels:
+ user-signedup:
+ description: A user has signed up for our service
+ publish:
+ operationId: receiveMessage
+ description: receive messages from the topic
+ bindings:
+ sns:
+ consumers:
+ - protocol: sqs
+ endpoint:
+ name: user-signedup-queue # refers to a queue defined in this file, but not shown in this example
+ rawMessageDelivery: true
+ filterPolicy:
+ attributes:
+ reason:
+ anything-but: password-reset
+ redrivePolicy:
+ deadLetterQueue:
+ name: user-signedup-queue-dlq # refers toa queue defined in this file, but not show in this example
+```
+
+#### SNS to HTTP Pub Sub
+
+[](SNS-HTTP.png)
+
+We are producing to an SNS channel.
+
+In this version, we define a default delivery policy for any HTTP based consumers
+
+```yaml
+channels:
+ user-signedup:
+ description: A user has signed up for our service
+ bindings:
+ sns:
+ policy:
+ statements:
+ - effect : Allow
+ principal: *
+ action: SNS:Publish
+ subscribe:
+ operationId: sendMessage
+ description: send messages to the topic
+ bindings:
+ sns:
+ deliveryPolicy:
+ minDelayTarget: 1
+ maxDelayTarget: 60
+ numRetries: 50
+ numNoDelayRetries: 3
+ numMinDelayRetries: 2
+ numMaxDelayRetries: 35
+ backoffFunction: exponential
+ maxReceivesPerSecond: 10
+```
+We are consuming an SNS channel, using an HTTP endpoint, which is defined in this AsyncAPI file. For brevity we do not show an http endpoint here. The delivery policy here is defined for the http consumer and overrides any policy set by the producer
+```yaml
+channels:
+ user-signedup:
+ description: A user has signed up for our service
+ bindings:
+ sns: {} # Indicates that the channel is an SNS Topic, but assumes defined by producer
+ publish:
+ operationId: receiveMessage
+ description: receive messages from the topic
+ bindings:
+ sns:
+ - protocol: http
+ endpoint:
+ url: http://login.my.com/user/new
+ filterPolicy:
+ attributes:
+ reason:
+ anything-but: password-reset
+ deliveryPolicy:
+ minDelayTarget: 1
+ maxDelayTarget: 120
+ numRetries: 30
+ numNoDelayRetries: 3
+ numMinDelayRetries: 2
+ numMaxDelayRetries: 25
+ backoffFunction: exponential
+ maxReceivesPerSecond: 20
+ redrivePolicy:
+ deadLetterQueue:
+ name: user-signedup-queue-dlq # refers toa queue defined in this file, but not show in this example
+```
diff --git a/sns/SNS-HTTP.png b/sns/SNS-HTTP.png
new file mode 100644
index 00000000..72e52c73
Binary files /dev/null and b/sns/SNS-HTTP.png differ
diff --git a/sns/SNS-SQS-Pub-Sub.png b/sns/SNS-SQS-Pub-Sub.png
new file mode 100644
index 00000000..033d6de7
Binary files /dev/null and b/sns/SNS-SQS-Pub-Sub.png differ
diff --git a/sns/json_schemas/channel.json b/sns/json_schemas/channel.json
new file mode 100644
index 00000000..6ab5e2f6
--- /dev/null
+++ b/sns/json_schemas/channel.json
@@ -0,0 +1,150 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "$id": "http://asyncapi.com/bindings/sns/channel.json",
+ "title": "Channel Schema",
+ "description": "This object contains information about the channel representation in SNS.",
+ "type": "object",
+ "additionalProperties": false,
+ "patternProperties": {
+ "^x-[\\w\\d\\.\\-\\_]+$": {
+ "$ref": "https://raw.githubusercontent.com/asyncapi/spec-json-schemas/v2.14.0/schemas/2.4.0.json#/definitions/specificationExtension"
+ }
+ },
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "The name of the topic. Can be different from the channel name to allow flexibility around AWS resource naming limitations."
+ },
+ "ordering": {
+ "$ref": "#/definitions/ordering"
+ },
+ "policy": {
+ "$ref": "#/definitions/policy"
+ },
+ "tags": {
+ "type": "object",
+ "description": "Key-value pairs that represent AWS tags on the topic."
+ },
+ "bindingVersion": {
+ "type": "string",
+ "description": "The version of this binding.",
+ "default": "latest"
+ }
+ },
+ "required": [
+ "name"
+ ],
+ "definitions": {
+ "ordering": {
+ "type": "object",
+ "description": "By default, we assume an unordered SNS topic. This field allows configuration of a FIFO SNS Topic.",
+ "patternProperties": {
+ "^x-[\\w\\d\\.\\-\\_]+$": {
+ "$ref": "https://raw.githubusercontent.com/asyncapi/spec-json-schemas/v2.14.0/schemas/2.4.0.json#/definitions/specificationExtension"
+ }
+ },
+ "properties": {
+ "type": {
+ "type": "string",
+ "description": "Defines the type of SNS Topic.",
+ "enum": [
+ "standard",
+ "FIFO"
+ ]
+ },
+ "contentBasedDeduplication": {
+ "type": "boolean",
+ "description": "True to turn on de-duplication of messages for a channel."
+ }
+ },
+ "required": [
+ "type"
+ ]
+ },
+ "policy": {
+ "type": "object",
+ "description": "The security policy for the SNS Topic.",
+ "patternProperties": {
+ "^x-[\\w\\d\\.\\-\\_]+$": {
+ "$ref": "https://raw.githubusercontent.com/asyncapi/spec-json-schemas/v2.14.0/schemas/2.4.0.json#/definitions/specificationExtension"
+ }
+ },
+ "properties": {
+ "statements": {
+ "type": "array",
+ "description": "An array of statement objects, each of which controls a permission for this topic",
+ "items": {
+ "$ref": "#/definitions/statement"
+ }
+ }
+ },
+ "required": [
+ "statements"
+ ]
+ },
+ "statement": {
+ "type": "object",
+ "patternProperties": {
+ "^x-[\\w\\d\\.\\-\\_]+$": {
+ "$ref": "https://raw.githubusercontent.com/asyncapi/spec-json-schemas/v2.14.0/schemas/2.4.0.json#/definitions/specificationExtension"
+ }
+ },
+ "properties": {
+ "effect": {
+ "type": "string",
+ "enum": [
+ "Allow",
+ "Deny"
+ ]
+ },
+ "principal": {
+ "description": "The AWS account or resource ARN that this statement applies to.",
+ "oneOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ ]
+ },
+ "action": {
+ "description": "The SNS permission being allowed or denied e.g. sns:Publish",
+ "oneOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ ]
+ }
+ },
+ "required": [
+ "effect",
+ "principal",
+ "action"
+ ]
+ }
+ },
+ "examples": [
+ {
+ "name": "my-sns-topic",
+ "policy": {
+ "statements": [
+ {
+ "effect": "Allow",
+ "principal": "*",
+ "action": "SNS:Publish"
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/sns/json_schemas/operation.json b/sns/json_schemas/operation.json
new file mode 100644
index 00000000..df59a327
--- /dev/null
+++ b/sns/json_schemas/operation.json
@@ -0,0 +1,277 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "$id": "http://asyncapi.com/bindings/sns/operation.json",
+ "title": "Operation Schema",
+ "description": "This object contains information about the operation representation in SNS.",
+ "type": "object",
+ "additionalProperties": false,
+ "patternProperties": {
+ "^x-[\\w\\d\\.\\-\\_]+$": {
+ "$ref": "https://raw.githubusercontent.com/asyncapi/spec-json-schemas/v2.14.0/schemas/2.4.0.json#/definitions/specificationExtension"
+ }
+ },
+ "properties": {
+ "topic": {
+ "$ref": "#/definitions/identifier",
+ "description": "Often we can assume that the SNS Topic is the channel name-we provide this field in case the you need to supply the ARN, or the Topic name is not the channel name in the AsyncAPI document."
+ },
+ "consumers": {
+ "type": "array",
+ "description": "The protocols that listen to this topic and their endpoints.",
+ "items": {
+ "$ref": "#/definitions/consumer"
+ },
+ "minItems": 1
+ },
+ "deliveryPolicy": {
+ "$ref": "#/definitions/deliveryPolicy",
+ "description": "Policy for retries to HTTP. The field is the default for HTTP receivers of the SNS Topic which may be overridden by a specific consumer."
+ },
+ "bindingVersion": {
+ "type": "string",
+ "description": "The version of this binding.",
+ "default": "latest"
+ }
+ },
+ "required": [
+ "consumers"
+ ],
+ "definitions": {
+ "identifier": {
+ "type": "object",
+ "patternProperties": {
+ "^x-[\\w\\d\\.\\-\\_]+$": {
+ "$ref": "https://raw.githubusercontent.com/asyncapi/spec-json-schemas/v2.14.0/schemas/2.4.0.json#/definitions/specificationExtension"
+ }
+ },
+ "properties": {
+ "url": {
+ "type": "string",
+ "description": "The endpoint is a URL."
+ },
+ "email": {
+ "type": "string",
+ "description": "The endpoint is an email adress."
+ },
+ "phone": {
+ "type": "string",
+ "description": "The endpoint is a phone number."
+ },
+ "arn": {
+ "type": "string",
+ "description": "The target is an ARN. For example, for SQS, the identifier may be an ARN, which will be of the form: arn:aws:sqs:{region}:{account-id}:{queueName}"
+ },
+ "name": {
+ "type": "string",
+ "description": "The endpoint is identified by a name, which corresponds to an identifying field called 'name' of a binding for that protocol on this publish Operation Object. For example, if the protocol is 'sqs' then the name refers to the name field sqs binding. We don't use $ref because we are referring, not including."
+ }
+ }
+ },
+ "consumer": {
+ "type": "object",
+ "patternProperties": {
+ "^x-[\\w\\d\\.\\-\\_]+$": {
+ "$ref": "https://raw.githubusercontent.com/asyncapi/spec-json-schemas/v2.14.0/schemas/2.4.0.json#/definitions/specificationExtension"
+ }
+ },
+ "properties": {
+ "protocol": {
+ "description": "The protocol that this endpoint receives messages by.",
+ "type": "string",
+ "enum": [
+ "http",
+ "https",
+ "email",
+ "email-json",
+ "sms",
+ "sqs",
+ "application",
+ "lambda",
+ "firehose"
+ ]
+ },
+ "endpoint": {
+ "description": "The endpoint messages are delivered to.",
+ "$ref": "#/definitions/identifier"
+ },
+ "filterPolicy": {
+ "$ref": "#/definitions/filterPolicy"
+ },
+ "rawMessageDelivery": {
+ "type": "boolean",
+ "description": "If true AWS SNS attributes are removed from the body, and for SQS, SNS message attributes are copied to SQS message attributes. If false the SNS attributes are included in the body."
+ },
+ "redrivePolicy": {
+ "$ref": "#/definitions/redrivePolicy"
+ },
+ "deliveryPolicy": {
+ "$ref": "#/definitions/deliveryPolicy",
+ "description": "Policy for retries to HTTP. The parameter is for that SNS Subscription and overrides any policy on the SNS Topic."
+ },
+ "displayName": {
+ "type": "string",
+ "description": "The display name to use with an SNS subscription"
+ }
+ },
+ "required": [
+ "protocol",
+ "endpoint",
+ "rawMessageDelivery"
+ ]
+ },
+ "deliveryPolicy": {
+ "type": "object",
+ "patternProperties": {
+ "^x-[\\w\\d\\.\\-\\_]+$": {
+ "$ref": "https://raw.githubusercontent.com/asyncapi/spec-json-schemas/v2.14.0/schemas/2.4.0.json#/definitions/specificationExtension"
+ }
+ },
+ "properties": {
+ "minDelayTarget": {
+ "type": "integer",
+ "description": "The minimum delay for a retry in seconds."
+ },
+ "maxDelayTarget": {
+ "type": "integer",
+ "description": "The maximum delay for a retry in seconds."
+ },
+ "numRetries": {
+ "type": "integer",
+ "description": "The total number of retries, including immediate, pre-backoff, backoff, and post-backoff retries."
+ },
+ "numNoDelayRetries": {
+ "type": "integer",
+ "description": "The number of immediate retries (with no delay)."
+ },
+ "numMinDelayRetries": {
+ "type": "integer",
+ "description": "The number of immediate retries (with delay)."
+ },
+ "numMaxDelayRetries": {
+ "type": "integer",
+ "description": "The number of post-backoff phase retries, with the maximum delay between retries."
+ },
+ "backoffFunction": {
+ "type": "string",
+ "description": "The algorithm for backoff between retries.",
+ "enum": [
+ "arithmetic",
+ "exponential",
+ "geometric",
+ "linear"
+ ]
+ },
+ "maxReceivesPerSecond": {
+ "type": "integer",
+ "description": "The maximum number of deliveries per second, per subscription."
+ }
+ }
+ },
+ "filterPolicy": {
+ "type": "object",
+ "description": "Only receive a subset of messages from the channel, determined by this policy.",
+ "patternProperties": {
+ "^x-[\\w\\d\\.\\-\\_]+$": {
+ "$ref": "https://raw.githubusercontent.com/asyncapi/spec-json-schemas/v2.14.0/schemas/2.4.0.json#/definitions/specificationExtension"
+ }
+ },
+ "properties": {
+ "attributes": {
+ "type": "object",
+ "description": "A map of a message attribute to an array of possible matches. The match may be a simple string for an exact match, but it may also be an object that represents a constraint and values for that constraint.",
+ "additionalProperties": {
+ "oneOf": [
+ {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "object"
+ }
+ ]
+ }
+ }
+ },
+ "required": [
+ "attributes"
+ ]
+ },
+ "redrivePolicy": {
+ "type": "object",
+ "description": "Prevent poison pill messages by moving un-processable messages to an SQS dead letter queue.",
+ "patternProperties": {
+ "^x-[\\w\\d\\.\\-\\_]+$": {
+ "$ref": "https://raw.githubusercontent.com/asyncapi/spec-json-schemas/v2.14.0/schemas/2.4.0.json#/definitions/specificationExtension"
+ }
+ },
+ "properties": {
+ "deadLetterQueue": {
+ "$ref": "#/definitions/identifier",
+ "description": "The SQS queue to use as a dead letter queue (DLQ)."
+ },
+ "maxReceiveCount": {
+ "type": "integer",
+ "description": "The number of times a message is delivered to the source queue before being moved to the dead-letter queue.",
+ "default": 10
+ }
+ },
+ "required": [
+ "deadLetterQueue"
+ ]
+ }
+ },
+ "examples": [
+ {
+ "topic": {
+ "name": "someTopic"
+ },
+ "consumers": [
+ {
+ "protocol": "sqs",
+ "endpoint": {
+ "name": "someQueue"
+ },
+ "filterPolicy": {
+ "attributes": {
+ "store": [
+ "asyncapi_corp"
+ ],
+ "event": [
+ {
+ "anything-but": "order_cancelled"
+ }
+ ],
+ "customer_interests": [
+ "rugby",
+ "football",
+ "baseball"
+ ]
+ }
+ },
+ "rawMessageDelivery": false,
+ "redrivePolicy": {
+ "deadLetterQueue": {
+ "arn": "arn:aws:SQS:eu-west-1:0000000:123456789"
+ },
+ "maxReceiveCount": 25
+ },
+ "deliveryPolicy": {
+ "minDelayTarget": 10,
+ "maxDelayTarget": 100,
+ "numRetries": 5,
+ "numNoDelayRetries": 2,
+ "numMinDelayRetries": 3,
+ "numMaxDelayRetries": 5,
+ "backoffFunction": "linear",
+ "maxReceivesPerSecond": 2
+ }
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/sqs/README.md b/sqs/README.md
index 8bccca3f..1475139d 100644
--- a/sqs/README.md
+++ b/sqs/README.md
@@ -2,36 +2,236 @@
This document defines how to describe SQS-specific information on AsyncAPI.
+SQS can be used both stand-alone as a point-to-point and paired with SNS and as a publish-subscribe channel (where SQS is the endpoint that SNS delivers messages to). For this reason we define a Queue schema, and reference that schema from both a Channel Binding Object and a **publish** Operation Binding Object.
+
+For point-to-point scenarios, use the Channel Binding Object, as producers send to the queue and consumers receive from it directly.
+
+For publish-subscribe scenarios, use as a **publish** Operation Binding Object, as the producer sends to SNS and the consumer receives via SQS.
+
## Version
Current version is `0.1.0`.
-
## Server Binding Object
This object MUST NOT contain any properties. Its name is reserved for future use.
-
-
-## Channel Binding Object
-
-This object MUST NOT contain any properties. Its name is reserved for future use.
-
+## Channel Binding Object
+
+Use the Channel Binding Operation for Point-to-Point SQS channels.
+
+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).
+
+### Fields
+|Field Name | Type | Description|
+|---|:---:|---|
+| `queue` | [Queue](#queue)| **Required.** A definition of the queue that will be used as the channel. |
+| `deadLetterQueue` | [Queue](#queue)| **Optional.** A definition of the queue that will be used for un-processable messages. |
+|`bindingVersion` | string | **Optional**, defaults to `latest`. The version of this binding.|
+
+### Schemas
+
+#### Queue
+|Field Name | Type | Description|
+|---|:---:|---|
+| `name` | string | **Required.** The name of the queue. When an [SNS Operation Binding Object]() references an SQS queue by name, the identifier should be the one in this field.|
+| `fifoQueue` | boolean | **Required.** Is this a FIFO queue? |
+| `deliveryDelay` | integer | **Optional.** The number of seconds to delay before a message sent to the queue can be received. Used to create a *delay queue*. Range is 0 to 15 minutes. Defaults to 0. |
+| `visibilityTimeout` |integer| **Optional.** The length of time, in seconds, that a consumer locks a message - hiding it from reads - before it is unlocked and can be read again. Range from 0 to 12 hours (43200 seconds). Defaults to 30 seconds. |
+| `receiveMessageWaitTime` |integer| **Optional.** Determines if the queue uses [short polling](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-short-and-long-polling.html) or [long polling](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-short-and-long-polling.html). Set to zero (the default) the queue reads available messages and returns immediately. Set to a non-zero integer, long polling waits the specified number of seconds for messages to arrive before returning. |
+| `messageRetentionPeriod` |integer| **Optional.** How long to retain a message on the queue in seconds, unless deleted. The range is 60 (1 minute) to 1,209,600 (14 days). The default is 345,600 (4 days). |
+| `redrivePolicy` | [Redrive Policy](#redrive-policy) | **Optional.** Prevent poison pill messages by moving un-processable messages to an SQS dead letter queue.|
+| `policy` |[Policy](#policy) | **Optional.** The security policy for the SQS Queue |
+| `tags` |Object | **Optional.** Key-value pairs that represent AWS tags on the queue. |
+
+#### Identifier
+|Field Name | Type | Description|
+|---|:---:|---|
+|`arn` |string| **Optional.** The target is an [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). For example, for SQS, the identifier may be an ARN, which will be of the form: ["arn:aws:sqs:{region}:{account-id}:{queueName}"](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)|
+|`name` |string| **Optional.** The endpoint is identified by a name, which corresponds to an identifying field called 'name' of a binding for that protocol on this **publish** Operation Object. For example, if the protocol is 'sqs' then the name refers to the name field **sqs** binding|
+
+#### Policy
+|Field Name | Type | Description|
+|---|:---:|---|
+| `Statements` | [Statement](#statement) | **Required.** An array of Statement objects, each of which controls a permission for this queue. |
+
+#### Redrive Policy
+|Field Name | Type | Description|
+|---|:---:|---|
+| `deadLetterQueue` |[Identifier](#identifier)| The SQS queue to use as a dead letter queue (DLQ) |
+| `maxReceiveCount` |integer| **Optional.** The number of times a message is delivered to the source queue before being moved to the dead-letter queue. Default is 10. |
+
+#### Statement
+|Field Name | Type | Description|
+|---|:---:|---|
+| `effect` | string |**Required.** Either "Allow" or "Deny"|
+| `principal` | string or array of string |**Required.** The AWS account or resource ARN that this statement applies to|
+| `action` | string or array of string |**Required.** The SQS permission being allowed or denied e.g. sqs:ReceiveMessage |
## Operation Binding Object
-This object MUST NOT contain any properties. Its name is reserved for future use.
+### SQS Point-To-Point
+
+Because we have defined Queue as part of the Channel Binding Binding object, we do not require Binding information for the **publish** Operation Object of the **subscribe** Operation Object. You can use an empty Queue object ({}) to denote the Binding on the Operation Object, if you want to indicate the protocol used to send or receive for generation purposes such as Infrastructure As Code.
+
+### SNS to SQS Pub-Sub
+
+Use the Operation Binding Object when SQS is listening to an SNS Topic. In this case we need to define both an SQS Operation Binding Objects on the receiver **publish** Operation Object to represent the queue definition and we need to define an SNS Operation Binding Object to define the Subscription to SNS that makes your queue a receiver of that endpoint.
+
+Assuming you have separate AsyncAPI specifications for the producer and the consumer, we would assume the following bindings would appear for an SNS producer and an SQS consumer.
+Producer: SNS Channel Binding Object, SNS **subscribe** Operation Binding Object [if required]
+Consumer: SNS **publish** Operation Binding Object, SQS **publish** Operation Binding Object
+- We assume that the SNS binding information only needs to be present in the producer file (although defining it in both is allowable) and any infrastructure as code dependencies can recognize this.
+
+
+On an Operation Binding Object we support an array of Queue objects. Members of this array may be Queue Objects that define the *endpoint* field required by an [SNS Operation Object]() delivering by the SQS protocol or Queue Objects that define the Dead Letter Queue used by either the Redrive Policy of the SNS Subscription (see the SNS Binding Object) or the [Redrive Policy of the SQS Queue](#redrive-policy). The name of the Queue Object is used by an Identifier field on either the *endpoint* field of the SNS Operation Object of *deadLetterQueue* on the Redrive Policy to identify the required member of this array.
+
+
+### Fields
+|Field Name | Type | Description|
+|---|:---:|---|
+| `queues` | [[Queue](#queue)]| **Required.** Queue objects that are either the *endpoint* for an SNS Operation Binding Object, or the *deadLetterQueue* of the SQS Operation Binding Object |
+|`bindingVersion` | string | **Optional**, defaults to `latest`. The version of this binding.|
+
+### Examples
+
+#### SQS Point-To-Point
+
+[](SQS-Point-To-Point.png)
+
+In this example, we are using SQS for a point-to-point channel. For this example, we assume that we are defining two microservices that communicate over a shared SQS channel, with the consumer receiving events over that channel and the producer owning the channel definition.
+
+The producer file would look like this:
+
+```yaml
+channels:
+ user-signedup:
+ bindings:
+ sqs:
+ queue:
+ name: user-signedup-queue
+ type: standard
+ receiveMessageWaitTime: 4
+ redrivePolicy:
+ deadLetterQueue:
+ name: user-signedup-dlq
+ policy:
+ statements:
+ - effect : Allow
+ principal: *
+ action: Sqs:SendMessage
+ - effect : Allow
+ principal: *
+ action: Sqs:ReceiveMessage
+ deadLetterQueue:
+ name: user-signedup-dlq
+ messageRetentionPeriod: 1209600
+ type: standard
+ subscribe:
+ operationId: sendMessage
+ description: sends messages when a user has signed up
+ bindings:
+ sqs: {}
+
+```
+In this case we can minimize duplicated information by omitting the binding in our specification, and assume it is picked up from the producer file. We can use an empty object to indicate the SQS Binding on the **publish** Operation Object, if need a marker for generation, otherwise we could omit the Operation Binding Object.
+
+```yaml
+channels:
+ user-signedup:
+ publish:
+ operationId: receiveMessage
+ description: receives a messages when a user has signed up
+ bindings:
+ sqs: {}
+
+```
+
+#### SNS to SQS Pub-Sub
+
+[](SNS-SQS-Pub-Sub.png)
+
+In this example, we are using SNS for the channel, and SQS to receive from SNS.
+
+
+The producer files looks like this (see the [SNS Binding]() for more).
+
+```yaml
+channels:
+ user-signedup:
+ description: A user has signed up for our service
+ binding :
+ sns: {} # Indicates that the channel is an SNS Topic
+ subscribe:
+ operationId: sendMessage
+ description: send messages to the topic
+ bindings:
+ sns:
+ policy:
+ statements:
+ - effect : Allow
+ principal: *
+ action: SNS:Publish
+```
+
+And the consumer file would look like this. Note that for simplicity, we choose not to repeat the SNS Binding on the Consumer as it does not 'own' the channel.
+
+
+```yaml
+channels:
+ user-signedup:
+ description: A user has signed up for our service
+ publish:
+ operationId: receiveMessage
+ description: receive messages from the topic
+ bindings:
+ sns:
+ consumers:
+ - protocol: sqs
+ endpoint:
+ name: user-signedup-queue
+ rawMessageDelivery: true
+ filterPolicy:
+ attributes:
+ reason:
+ anything-but: password-reset
+ redrivePolicy:
+ deadLetterQueue:
+ name: user-signedup-queue-dlq
+ sqs:
+ queues:
+ - name: user-signedup-queue
+ type: standard
+ receiveMessageWaitTime: 4
+ policy:
+ statements:
+ - effect : Allow
+ principal: *
+ action: Sqs:SendMessage
+ - effect : Allow
+ principal: *
+ action: Sqs:ReceiveMessage
+ - name: user-signedup-dlq
+ messageRetentionPeriod: 1209600
+ type: standard
+```
diff --git a/sqs/SNS-SQS-Pub-Sub.png b/sqs/SNS-SQS-Pub-Sub.png
new file mode 100644
index 00000000..033d6de7
Binary files /dev/null and b/sqs/SNS-SQS-Pub-Sub.png differ
diff --git a/sqs/SQS-Point-To-Point.png b/sqs/SQS-Point-To-Point.png
new file mode 100644
index 00000000..a94cfc7b
Binary files /dev/null and b/sqs/SQS-Point-To-Point.png differ
diff --git a/sqs/json_schemas/channel.json b/sqs/json_schemas/channel.json
new file mode 100644
index 00000000..3930780a
--- /dev/null
+++ b/sqs/json_schemas/channel.json
@@ -0,0 +1,246 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "$id": "http://asyncapi.com/bindings/sqs/channel.json",
+ "title": "Channel Schema",
+ "description": "This object contains information about the channel representation in SQS.",
+ "type": "object",
+ "additionalProperties": false,
+ "patternProperties": {
+ "^x-[\\w\\d\\.\\-\\_]+$": {
+ "$ref": "https://raw.githubusercontent.com/asyncapi/spec-json-schemas/v2.14.0/schemas/2.4.0.json#/definitions/specificationExtension"
+ }
+ },
+ "properties": {
+ "queue": {
+ "description": "A definition of the queue that will be used as the channel.",
+ "$ref": "#/definitions/queue"
+ },
+ "deadLetterQueue": {
+ "description": "A definition of the queue that will be used for un-processable messages.",
+ "$ref": "#/definitions/queue"
+ },
+ "bindingVersion": {
+ "type": "string",
+ "description": "The version of this binding.",
+ "default": "latest"
+ }
+ },
+ "required": [
+ "queue"
+ ],
+ "definitions": {
+ "queue": {
+ "type": "object",
+ "description": "A definition of a queue.",
+ "patternProperties": {
+ "^x-[\\w\\d\\.\\-\\_]+$": {
+ "$ref": "https://raw.githubusercontent.com/asyncapi/spec-json-schemas/v2.14.0/schemas/2.4.0.json#/definitions/specificationExtension"
+ }
+ },
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "The name of the queue. When an SNS Operation Binding Object references an SQS queue by name, the identifier should be the one in this field."
+ },
+ "fifoQueue": {
+ "type": "boolean",
+ "description": "Is this a FIFO queue?",
+ "default": false
+ },
+ "deliveryDelay": {
+ "type": "integer",
+ "description": "The number of seconds to delay before a message sent to the queue can be received. used to create a delay queue.",
+ "minimum": 0,
+ "maximum": 15,
+ "default": 0
+ },
+ "visibilityTimeout": {
+ "type": "integer",
+ "description": "The length of time, in seconds, that a consumer locks a message - hiding it from reads - before it is unlocked and can be read again.",
+ "minimum": 0,
+ "maximum": 43200,
+ "default": 30
+ },
+ "receiveMessageWaitTime": {
+ "type": "integer",
+ "description": "Determines if the queue uses short polling or long polling. Set to zero the queue reads available messages and returns immediately. Set to a non-zero integer, long polling waits the specified number of seconds for messages to arrive before returning.",
+ "default": 0
+ },
+ "messageRetentionPeriod": {
+ "type": "integer",
+ "description": "How long to retain a message on the queue in seconds, unless deleted.",
+ "minimum": 60,
+ "maximum": 1209600,
+ "default": 345600
+ },
+ "redrivePolicy": {
+ "$ref": "#/definitions/redrivePolicy"
+ },
+ "policy": {
+ "$ref": "#/definitions/policy"
+ },
+ "tags": {
+ "type": "object",
+ "description": "Key-value pairs that represent AWS tags on the queue."
+ }
+ },
+ "required": [
+ "name",
+ "fifoQueue"
+ ]
+ },
+ "redrivePolicy": {
+ "type": "object",
+ "description": "Prevent poison pill messages by moving un-processable messages to an SQS dead letter queue.",
+ "patternProperties": {
+ "^x-[\\w\\d\\.\\-\\_]+$": {
+ "$ref": "https://raw.githubusercontent.com/asyncapi/spec-json-schemas/v2.14.0/schemas/2.4.0.json#/definitions/specificationExtension"
+ }
+ },
+ "properties": {
+ "deadLetterQueue": {
+ "$ref": "#/definitions/identifier"
+ },
+ "maxReceiveCount": {
+ "type": "integer",
+ "description": "The number of times a message is delivered to the source queue before being moved to the dead-letter queue.",
+ "default": 10
+ }
+ },
+ "required": [
+ "deadLetterQueue"
+ ]
+ },
+ "identifier": {
+ "type": "object",
+ "description": "The SQS queue to use as a dead letter queue (DLQ).",
+ "patternProperties": {
+ "^x-[\\w\\d\\.\\-\\_]+$": {
+ "$ref": "https://raw.githubusercontent.com/asyncapi/spec-json-schemas/v2.14.0/schemas/2.4.0.json#/definitions/specificationExtension"
+ }
+ },
+ "properties": {
+ "arn": {
+ "type": "string",
+ "description": "The target is an ARN. For example, for SQS, the identifier may be an ARN, which will be of the form: arn:aws:sqs:{region}:{account-id}:{queueName}"
+ },
+ "name": {
+ "type": "string",
+ "description": "The endpoint is identified by a name, which corresponds to an identifying field called 'name' of a binding for that protocol on this publish Operation Object. For example, if the protocol is 'sqs' then the name refers to the name field sqs binding."
+ }
+ }
+ },
+ "policy": {
+ "type": "object",
+ "description": "The security policy for the SQS Queue",
+ "patternProperties": {
+ "^x-[\\w\\d\\.\\-\\_]+$": {
+ "$ref": "https://raw.githubusercontent.com/asyncapi/spec-json-schemas/v2.14.0/schemas/2.4.0.json#/definitions/specificationExtension"
+ }
+ },
+ "properties": {
+ "statements": {
+ "type": "array",
+ "description": "An array of statement objects, each of which controls a permission for this queue.",
+ "items": {
+ "$ref": "#/definitions/statement"
+ }
+ }
+ },
+ "required": [
+ "statements"
+ ]
+ },
+ "statement": {
+ "type": "object",
+ "patternProperties": {
+ "^x-[\\w\\d\\.\\-\\_]+$": {
+ "$ref": "https://raw.githubusercontent.com/asyncapi/spec-json-schemas/v2.14.0/schemas/2.4.0.json#/definitions/specificationExtension"
+ }
+ },
+ "properties": {
+ "effect": {
+ "type": "string",
+ "enum": [
+ "Allow",
+ "Deny"
+ ]
+ },
+ "principal": {
+ "description": "The AWS account or resource ARN that this statement applies to.",
+ "oneOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ ]
+ },
+ "action": {
+ "description": "The SQS permission being allowed or denied e.g. sqs:ReceiveMessage",
+ "oneOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ ]
+ }
+ },
+ "required": [
+ "effect",
+ "principal",
+ "action"
+ ]
+ }
+ },
+ "examples": [
+ {
+ "queue": {
+ "name": "myQueue",
+ "fifoQueue": true,
+ "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
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/sqs/json_schemas/operation.json b/sqs/json_schemas/operation.json
new file mode 100644
index 00000000..9f26e977
--- /dev/null
+++ b/sqs/json_schemas/operation.json
@@ -0,0 +1,239 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "$id": "http://asyncapi.com/bindings/sqs/operation.json",
+ "title": "Operation Schema",
+ "description": "This object contains information about the operation representation in SQS.",
+ "type": "object",
+ "additionalProperties": false,
+ "patternProperties": {
+ "^x-[\\w\\d\\.\\-\\_]+$": {
+ "$ref": "https://raw.githubusercontent.com/asyncapi/spec-json-schemas/v2.14.0/schemas/2.4.0.json#/definitions/specificationExtension"
+ }
+ },
+ "properties": {
+ "queues": {
+ "type": "array",
+ "description": "Queue objects that are either the endpoint for an SNS Operation Binding Object, or the deadLetterQueue of the SQS Operation Binding Object.",
+ "items": {
+ "$ref": "#/definitions/queue"
+ }
+ },
+ "bindingVersion": {
+ "type": "string",
+ "description": "The version of this binding.",
+ "default": "latest"
+ }
+ },
+ "required": [
+ "queues"
+ ],
+ "definitions": {
+ "queue": {
+ "type": "object",
+ "description": "A definition of a queue.",
+ "patternProperties": {
+ "^x-[\\w\\d\\.\\-\\_]+$": {
+ "$ref": "https://raw.githubusercontent.com/asyncapi/spec-json-schemas/v2.14.0/schemas/2.4.0.json#/definitions/specificationExtension"
+ }
+ },
+ "properties": {
+ "$ref": {
+ "type": "string",
+ "description": "Allows for an external definition of a queue. The referenced structure MUST be in the format of a Queue. If there are conflicts between the referenced definition and this Queue's definition, the behavior is undefined."
+ },
+ "name": {
+ "type": "string",
+ "description": "The name of the queue. When an SNS Operation Binding Object references an SQS queue by name, the identifier should be the one in this field."
+ },
+ "fifoQueue": {
+ "type": "boolean",
+ "description": "Is this a FIFO queue?",
+ "default": false
+ },
+ "deliveryDelay": {
+ "type": "integer",
+ "description": "The number of seconds to delay before a message sent to the queue can be received. Used to create a delay queue.",
+ "minimum": 0,
+ "maximum": 15,
+ "default": 0
+ },
+ "visibilityTimeout": {
+ "type": "integer",
+ "description": "The length of time, in seconds, that a consumer locks a message - hiding it from reads - before it is unlocked and can be read again.",
+ "minimum": 0,
+ "maximum": 43200,
+ "default": 30
+ },
+ "receiveMessageWaitTime": {
+ "type": "integer",
+ "description": "Determines if the queue uses short polling or long polling. Set to zero the queue reads available messages and returns immediately. Set to a non-zero integer, long polling waits the specified number of seconds for messages to arrive before returning.",
+ "default": 0
+ },
+ "messageRetentionPeriod": {
+ "type": "integer",
+ "description": "How long to retain a message on the queue in seconds, unless deleted.",
+ "minimum": 60,
+ "maximum": 1209600,
+ "default": 345600
+ },
+ "redrivePolicy": {
+ "$ref": "#/definitions/redrivePolicy"
+ },
+ "policy": {
+ "$ref": "#/definitions/policy"
+ },
+ "tags": {
+ "type": "object",
+ "description": "Key-value pairs that represent AWS tags on the queue."
+ }
+ },
+ "required": [
+ "name"
+ ]
+ },
+ "redrivePolicy": {
+ "type": "object",
+ "description": "Prevent poison pill messages by moving un-processable messages to an SQS dead letter queue.",
+ "patternProperties": {
+ "^x-[\\w\\d\\.\\-\\_]+$": {
+ "$ref": "https://raw.githubusercontent.com/asyncapi/spec-json-schemas/v2.14.0/schemas/2.4.0.json#/definitions/specificationExtension"
+ }
+ },
+ "properties": {
+ "deadLetterQueue": {
+ "$ref": "#/definitions/identifier"
+ },
+ "maxReceiveCount": {
+ "type": "integer",
+ "description": "The number of times a message is delivered to the source queue before being moved to the dead-letter queue.",
+ "default": 10
+ }
+ },
+ "required": [
+ "deadLetterQueue"
+ ]
+ },
+ "identifier": {
+ "type": "object",
+ "description": "The SQS queue to use as a dead letter queue (DLQ).",
+ "patternProperties": {
+ "^x-[\\w\\d\\.\\-\\_]+$": {
+ "$ref": "https://raw.githubusercontent.com/asyncapi/spec-json-schemas/v2.14.0/schemas/2.4.0.json#/definitions/specificationExtension"
+ }
+ },
+ "properties": {
+ "arn": {
+ "type": "string",
+ "description": "The target is an ARN. For example, for SQS, the identifier may be an ARN, which will be of the form: arn:aws:sqs:{region}:{account-id}:{queueName}"
+ },
+ "name": {
+ "type": "string",
+ "description": "The endpoint is identified by a name, which corresponds to an identifying field called 'name' of a binding for that protocol on this publish Operation Object. For example, if the protocol is 'sqs' then the name refers to the name field sqs binding."
+ }
+ }
+ },
+ "policy": {
+ "type": "object",
+ "description": "The security policy for the SQS Queue",
+ "patternProperties": {
+ "^x-[\\w\\d\\.\\-\\_]+$": {
+ "$ref": "https://raw.githubusercontent.com/asyncapi/spec-json-schemas/v2.14.0/schemas/2.4.0.json#/definitions/specificationExtension"
+ }
+ },
+ "properties": {
+ "statements": {
+ "type": "array",
+ "description": "An array of statement objects, each of which controls a permission for this queue.",
+ "items": {
+ "$ref": "#/definitions/statement"
+ }
+ }
+ },
+ "required": [
+ "statements"
+ ]
+ },
+ "statement": {
+ "type": "object",
+ "patternProperties": {
+ "^x-[\\w\\d\\.\\-\\_]+$": {
+ "$ref": "https://raw.githubusercontent.com/asyncapi/spec-json-schemas/v2.14.0/schemas/2.4.0.json#/definitions/specificationExtension"
+ }
+ },
+ "properties": {
+ "effect": {
+ "type": "string",
+ "enum": [
+ "Allow",
+ "Deny"
+ ]
+ },
+ "principal": {
+ "description": "The AWS account or resource ARN that this statement applies to.",
+ "oneOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ ]
+ },
+ "action": {
+ "description": "The SQS permission being allowed or denied e.g. sqs:ReceiveMessage",
+ "oneOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ ]
+ }
+ },
+ "required": [
+ "effect",
+ "principal",
+ "action"
+ ]
+ }
+ },
+ "examples": [
+ {
+ "queues": [
+ {
+ "name": "myQueue",
+ "deliveryDelay": 10,
+ "redrivePolicy": {
+ "deadLetterQueue": {
+ "name": "myQueue_error"
+ },
+ "maxReceiveCount": 15
+ },
+ "policy": {
+ "statements": [
+ {
+ "effect": "Deny",
+ "principal": "arn:aws:iam::123456789012:user/dec.kolakowski",
+ "action": [
+ "sqs:SendMessage",
+ "sqs:ReceiveMessage"
+ ]
+ }
+ ]
+ }
+ },
+ {
+ "name": "myQueue_error",
+ "deliveryDelay": 10
+ }
+ ]
+ }
+ ]
+}