aws.sqs » receiveMessage(profile,queue,var)
Description
The command instructs Nexial to receive a message from an SQS queue
and store such message object 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.
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 a message from the nexial-test-queue
queue, prints out the message details, and then
deletes the same message via its .receiptHandle
.
Suppose this message contains an attribute named “create date”. To retrieve such information, one would use
${message}.[attributes].[create date]
.