SQS

Amazon Simple Queue Service (Amazon SQS) is a reliable, highly-scalable hosted queue for storing messages as they travel between applications or microservices. Amazon SQS moves data between distributed application components and helps you decouple these components. Source: AWS

Command

rhub add:action <group.eventId> <filterId> AWS SQS

Param

Description

eventId

The event that will receive te action.

Example: payment.payment-fulfilled

filterId

The filter/trigger in the event that will process the action.

Example: on-event

Prompt Questions

Operation Select the operation type, such as Standard or FIFO Queue.

Command Line Operation Selector

Operation

Description

Publish STANDARD Queue

Delivers a message to the specified queue, this message will be processed asynchronously. AWS Documentation.

Publish FIFO Queue

Delivers a message to the specified queue to be processed using a first in first out strategy.

AWS Documentation.

Publish Queue (Standard and FIFO)

By adding the publish queue operation, you must specify the queue URL; this URL is given by Amazon when you add a new queue in the console.

Important In your system, always store the entire queue URL exactly as Amazon SQS returns it to you when you create the queue (for example, https://sqs.us-east-2.amazonaws.com/123456789012/MyQueue). Don't build the queue URL from its separate components each time you need to specify the queue URL in a request because Amazon SQS can change the components that make up the queue URL. Source: AWS Documentation

This command generates a new entry into the event YAML configuration file, for example:

rhub add:action payment.payment-fulfilled on-event AWS SQS

The above command creates a new entry into the file /events/payment.payment-fulfilled.yaml under the filters/on-event/actions YAML node; it will look like this:

Standard Queue
FIFO Queue
Standard Queue

YAML

-
id: my-action
async: false
type: AWS
action: SQS
operation: 'Publish STANDARD Queue'
serviceAccountId: my-aws-us-east-account-id
template:
QueueUrl: 'https://sqs.us-east-2.amazonaws.com/123456789012/MyQueue'
MessageAttributes: null
payload:
amount: '{amount}'
client: '{client}'

YAML PARAMS

Params

Description

id, async, type, action, operation, serviceAccountId

The action default parameters, see more.

QueueUrl

AWS queue identifier.

MessageAttributes

Custom object structured metadata, each message can have up to 10 attributes, see more.

DelaySeconds

The length of time, in seconds, for which to delay a specific message. Valid values: 0 to 900. Maximum: 15 minutes. Messages with a positive DelaySeconds value become available for processing after the delay period is finished. If you don't specify a value, the default value for the queue applies.

payload

The message to send. The maximum string size is 256 KB.

By default it receives the event model map but you can change it as you please.

FIFO Queue
-
id: my-action
async: false
type: AWS
action: SQS
operation: 'Publish FIFO Queue'
serviceAccountId: my-aws-us-east-account-id
template:
QueueUrl: https://sqs.us-east-2.amazonaws.com/123456789012/MyQueue
MessageDeduplicationId: null
MessageGroupId: null
MessageAttributes: null
payload:
amount: '{amount}'
client: '{client}'

YAML Params

Param

Description

id, async, type, action, operation, serviceAccountId

The action default parameters, see more.

QueueUrl

AWS queue identifier.

MessageAttributes

Custom object structured metadata, each message can have up to 10 attributes, see more.​

MessageDeduplicationId

The token used for deduplication of sent messages. If a message with a particular MessageDeduplicationId is sent successfully, any messages sent with the same MessageDeduplicationId are accepted successfully but aren't delivered during the 5-minute deduplication interval, see more.

MessageGroupId

This parameter applies only to FIFO (first-in-first-out) queues.

The tag that specifies that a message belongs to a specific message group. Messages that belong to the same message group are processed in a FIFO manner (however, messages in different message groups might be processed out of order). To interleave multiple ordered streams within a single queue, use MessageGroupId values (for example, session data for multiple users). In this scenario, multiple consumers can process the queue, but the session data of each user is processed in a FIFO fashion, see more.

MessageAttributes

Custom object structured metadata, each message can have up to 10 attributes, see more.​

payload

The message to send. The maximum string size is 256 KB.

By default it receives the event model map but you can change it as you please.