title | summary | component | reviewed | related | |
---|---|---|---|---|---|
SQS Transport Scripting |
Example code and scripts to facilitate deployment and operational actions against the SQS Transport. |
SQS |
2024-03-27 |
|
The following are example code and scripts in C# and PowerShell to facilitate deployment and operations against the SQS Transport.
If using PowerShell, the AWS Tools for PowerShell must be installed and properly configured.
For all operations that create resources in AWS the corresponding rights must be granted. For more information refer to the IAM policies guide.
snippet: sqs-queue-name-helper
The above QueueNameHelper
makes sure that queues follow the proper naming guidelines for SQS.
snippet: sqs-powershell-queue-name-helper
A send involves the following actions:
- Create and serialize the payload including headers.
- Write a message body directly to SQS Transport.
snippet: sqs-nativesend
snippet: sqs-powershell-nativesend
snippet: sqs-nativesend-usage
The headers must contain the message type that is sent as a fully qualified assembly name as well as the message id header. See the headers documentation for more information on the EnclosedMessageTypes
and MessageId
headers.
A send involves the following actions:
- Create an unique S3 key containing the
S3Prefix
and theMessageId
- Upload the body of the message to the S3 bucket
- Create and serialize the message with an empty payload including headers and the
S3BodyKey
. - Write a message directly to SQS Transport.
snippet: sqs-nativesend-large
snippet: sqs-powershell-nativesend-large
snippet: sqs-nativesend-large-usage
The headers must contain the message type that is sent as a fully qualified assembly name as well as the message id header. See the headers documentation for more information on the EnclosedMessageTypes
and MessageId
headers.
The S3 bucket name and the S3 prefix must be provided as defined in the transport configuration of the endpoint that will be receiving the message.
partial: create
partial: delete
A retry involves the following actions:
- Read a message from the error queue.
- Forward that message to another queue to be retried.
snippet: sqs-return-to-source-queue
Warning
This example code will receive other messages from the error queue while it finds the desired message. All messages received by this code will be marked as invisible until the visibility timeout expires.
snippet: sqs-return-to-source-queue-usage