aws.sqs » receiveMessages(profile,queue,var)
Description
The command instructs Nexial to receive a list of available messages - up to 10 - from an SQS queue
and store such
message objects in a data variable denoted as var
.
Depending on the .aws.waitTimeMs
value, Nexial might not return any messages. In such case, the data variable denoted
as var
will be removed to avoid any confusion with previously retrieved messages. It is also possible that Nexial
might not return all available messages via the same command invocation. Both
Amazon SQS Visibility Timeout and message queue size both can have
impact in this.
Each SQS message would contain the following properties, which may be retrieved (read-only) during Nexial execution:
.id
- the message id..body
- this contains the message body (or content). Nexial presents this as plain text. According to AWS documentation, this should not exceed 256 KB..attributes
- this contains the message attribute(s) associated to this message. This can be thought of as “structured metadata” that provides more context and definition to the associated message. According to AWS documentation, each message can hold up to 10 attributes. To retrieve a specific attribute in Nexial, use the.[attributes].[name]
syntax (example below)..receiptHandle
- unique identifier to a message received. This property is required to delete a message from its queue.
Parameters
- profile - the profile added in the data file which contains AWS SES credentials and connectivity.
- queue - the target SQS queue name.
- var - the variable to store the retrieved message from this command.
Example
The above example retrieves messages from the nexial-test-queue
queue and prints out the message details.
Suppose this message contains an attribute named “create date”. To retrieve such information, one would use
${messages}[0].[attributes].[create date]
.