Stacktape
Stacktape


SQS Queue

This example shows a basic sqs queue configuration.

Basic example

resources:
mySqsQueue:
type: sqs-queue
properties:
# The amount of time each message delivery is delayed.
#
# - Specifies the time in seconds for which the delivery of all messages in the queue is delayed
# - You can specify an integer value of 0 to 900
#
# - Type: number
# - Required: false
# - Default: 0
delayMessagesSecond: 0
# The limit of how many bytes that a message can contain before queue rejects it
#
# - You can specify an integer value from 1,024 bytes (1 KiB) to 262,144 bytes (256 KiB).
#
# - Type: number
# - Required: false
# - Default: 262,144(256Kib)
maxMessageSizeBytes: 262,144(256Kib)
# The number of seconds that queue retains a message
#
# - You can specify an integer value from 60 seconds (1 minute) to 1,209,600 seconds (14 days).
#
# - Type: number
# - Required: false
# - Default: 345600(4days)
messageRetentionPeriodSeconds: 345600(4days)
# Enables long polling for receiving messages from queue
#
# - You can specify the duration, in seconds, that the ReceiveMessage action call waits until a message
# is in the queue in order to include it in the response, rather than returning an empty response
# if a message isn't yet available. This is called long polling.
# - In other words: sets default `WaitTimeSeconds` when consumer pulls messages from queue by calling
# [ReceiveMessage](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ReceiveMessage.html).
# - Long polling helps reduce the cost of using Amazon SQS by:
# - eliminating the number of empty responses (when there are no messages available for a ReceiveMessage request)
# - eliminating false empty responses (when messages are available but aren't included in a response).
# - If this value is set to 0(by default) **short polling** is used.
# - To understand differences between short and long polling refer to
# [AWS docs](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-short-and-long-polling.html#sqs-short-long-polling-differences)
#
# - Type: number
# - Required: false
# - Default: 0
longPollingSeconds: 0
# The length of time during which a message will be unavailable after a message is delivered from the queue
#
# - **Receiving messages explained:** When a consumer [receives and processes a message from a queue](https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/examples-sqs-messages.html#sqs-messages-receive),
# **the message remains in the queue**. Amazon SQS doesn't automatically delete the message.
# Because Amazon SQS is a distributed system, there's no guarantee that the consumer
# actually receives the message (for example, due to a connectivity issue, or due to an issue in the consumer application).
# Thus, the consumer must delete the message from the queue after receiving and processing it.
# - **Visibility timeout explained:** Immediately after a message is received, it remains in the queue(see above).
# To prevent other consumers from processing the message again, Amazon SQS sets a visibility timeout,
# a period of time during which Amazon SQS prevents other consumers from receiving and processing the message.
# - For more information about visibility timeout refer to
# [AWS docs](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html).
# - Visibility timeout must be from 0 to 43,200 seconds (12 hours)
#
# - Type: number
# - Required: false
# - Default: 30
visibilityTimeoutSeconds: 30
# If set to true, creates a FIFO queue
#
# - FIFO (First-In-First-Out) queues have all the capabilities of the standard queues,
# but are designed to enhance messaging between applications when the order of operations and events is critical,
# or where duplicates can't be tolerated.
# - For more information on FIFO queues refer to [AWS docs](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html)
# > When using FIFO, each message should contain `MessageDeduplicationId` or **contentBasedDeduplication** must be enabled.
#
# - Type: boolean
# - Required: false
# - Default: false
fifoEnabled: false
# If set to true, enables FIFO high throughput mode
#
# - High throughput of queue is achieved by partitioning queue messages into multiple partitions.
# - Partition management occurs automatically in the background and is transparent to your applications. Your queue and messages are available at all times.
# - Partitioning of messages is based on `messageGroupId` message tag that is used for calculating
# hashes - resulting hash determines which partition message belongs to.
# - Messages that belong to the same message group (have same `messageGroupId`) are always processed one by one.
# - For more information refer to [AWS docs](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/high-throughput-fifo.html)
# > FIFO must be enabled in order to use this feature
#
# - Type: boolean
# - Required: false
fifoHighThroughput: true
# If set to true, enables content based deduplication for FIFO queue
#
# - Specifies whether to enable content-based deduplication.
# **Deduplication explained:**
# - During the deduplication interval, queue treats messages identifies duplicates and delivers only one copy of the message
# - Duplicate messages are recognized based on `MessageDeduplicationId`:
# - You may provide a `MessageDeduplicationId` explicitly.
# - If you do not provide `MessageDeduplicationId`, content-based deduplication is used(if enabled) - this means Amazon SQS uses a SHA-256 hash to generate the `MessageDeduplicationId` using the body of the message (but not the attributes of the message).
# > FIFO must be enabled in order to use this feature
#
# - Type: boolean
# - Required: false
contentBasedDeduplication: true
# Redrive policy specifies conditions and settings for automatically moving messages that fail processing to a secondary queue.
#
# - Manages and handles messages that fail processing in this queue and sends them into a secondary dead-letter queue
# - Messages are sent into a dead letter queue once the message was retried `maxReceivedCount` times.
#
# - Type: object
# - Required: false
redrivePolicy:
# The number of times a message is delivered to the source queue before being moved to the target queue.
# - When the ReceiveCount for a message exceeds the maxReceiveCount for a queue, Amazon SQS moves the message to the target queue.
#
# - Type: number
# - Required: true
maxReceiveCount: 100
# Name of the SQS queue in Stacktape config where failed messages will be sent
#
# - Type: string
# - Required: false
targetSqsQueueName: myTargetSqsQueueName
# Arn of the SQS queue where failed messages will be sent
#
# - Type: string
# - Required: false
targetSqsQueueArn: example-value
# Adds policy statements to sqs queue policy
#
# - Statements are added on top of policy statements automatically inferred by Stacktape
#
# - Type: array<object (reference)>
# - Required: false
policyStatements:
- Action: ["example-value"]
Effect: example-value

Contents

  •  Basic example