SQS - Receive Message

 

Declaration

<AMAWSSQS ACTIVITY="receive_message" QUEUEURL="text" MAXMSG="number" TIMEOUT="number" ATTR="text(options)" RESULTDATASET="text" />

See Also

SQS - Add Permission | SQS - Change Message Visibility | SQS - Create Queue | SQS - Create Session | SQS - Delete Message | SQS - Delete Queue | SQS - End Session | SQS - Get Queue Attributes | SQS - List Queues | SQS - Receive Message | SQS - Remove Permission | SQS - Send Message | SQS - Set Queue Attributes

Description

Retrieves one or more messages from the specified queue. For each message returned, the response includes the following:

IMPORTANT: The SQS activities in AutoMate use the Amazon's SQS engine to perform their work. Because of this, you must have a valid Amazon SQS service account to use these activities.

Practical Usage

Used to receive one or more queue messages.

Parameters

Message Properties

Property

Type

Req'd

Default

Markup

Description

Queue URL

Text

Yes

(Empty)

QUEUEURL=

"https://queue.amazonaws.com/

963068290131/TestSNSNotification"

The URL uniquely identifying the queue, which includes the queue name and other components that SQS determines.

Max number of messages (between 1-10)

Number

Yes

1

MAXMSG="2"

Maximum number of messages to return.

Visibility Timeout (seconds)

Number

No

(Empty)

TIMEOUT="1260"

The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by an initial Receive Message request.

Attributes (optional)

Text (Options)

No

(Empty)

ATTR="ApproximateReceiveCount"

The attribute you want to get. The available options are:

  • All - Returns all values.

  • SenderID - Returns the AWS account number (or the IP address, if anonymous access is allowed) of the sender.

  • SentTimestamp - Returns the time when the message was sent (epoch time in milliseconds).

  • ApproximateReceiveCount - Returns the number of times a message has been received but not deleted.

  • ApproximateFirstReceiveTimestamp - returns the time when the message was first received (epoch time in milliseconds).

Create and populate dataset with SQS message information

Text

No

(Empty)

RESULTDATASET="theDataset"

The name of the dataset to create and populate with SQS message information being received. More details regarding datasets can be found below under Notes.

Credentials Properties

These properties allow you to enter a custom set of credentials specific to this activity or link this activity to an existing session created in a previous step.

Property

Type

Required

Default

Markup

Description

Provide Credentials

 

 

 

 

Indicates where this activity's credentials should originate from. Different properties apply depending on the option selected. The available options are:

  • Custom (Default) - Specifies that a custom set of credentials will be entered for this SQS activity. Select this option if performing a single SQS activity.

  • Session Based - Specifies that credentials should derive from a session created in a previous step with the use of the Create Session activity. This allows several SQS activities to be linked to a specific session, eliminating redundancy.

NOTE: This is a design-time parameter used interactively during  construction mode, thus, contains no markups.

Access Key

Text

Yes

(Empty)

ACCESSKEY="MyAccessKey"

A 20-character, alphanumeric string that uniquely identifies a user who owns a SQS account. This along with a Secret Access Key forms a secure information set that SQS uses to confirm a valid user's identity. This property is active only if Custom is selected under the Provide Credentials property.

Secret Access Key

Text

Yes

(Empty)

SECRETKEY="SecretKey"

A 40-character string that serves the role as Password to access SQS. This along with an associated Access Key forms a secure information set that SQS uses to confirm a valid user's identity. This property is active only if Custom is selected under the Provide Credentials property.

User Agent

Text

No

AutoMate

USERAGENT="AutoMate"

The User-Agent header name. The User-Agent request-header field contains information about the user agent originating the request such as time outs, proxies, name, etc. The default User Agent name is AutoMate. This property is active only if Custom is selected under the Provide Credentials property.

Service URL

Text

No

(Empty)

SERVICEURL=

"https://eu-west-1.ec2.amazonaws.com"

The Service URL used to make requests to the SQS service. The Service URL provides the service endpoint. For example, To make the service call to a different region, you can pass the region-specific endpoint, such as 'https://sdb.eu-west-1.amazonaws.com'. This property is active only if Custom is selected under the Provide Credentials property.

Maximum retry on error

Number

No

(Empty)

MAXERRORRETRY="4"

Signifies how many times the Amazon SQS engine should retry the request before returning an error. This property is active only if Custom is selected under the Provide Credentials property.

Proxy Host

Text

No

(Empty)

PROXYHOST="proxy.host.com"

The host name (server.domain.com) or IP address (xxx.xxx.xxx.xxx) of the proxy server. This property is active only if Custom is selected under the Provide Credentials property.

Proxy Port

Number

No

(Empty)

PROXYPORT="1028"

The port that should be used to connect to the proxy server. This property is active only if Custom is selected under the Provide Credentials property.

Signature Method

Text

No

(Empty)

 

SIGNMETHOD="HmacSHA256"

The Signature Method for signing the request. This property is active only if Custom is selected under the Provide Credentials property.

Signature Version

Number

No

(Empty)

SIGNVERSION="2"

The Signature Version for signing the request. The version refers to the particular algorithm for signing the request. This property is active only if Custom is selected under the Provide Credentials property.

Session Name

Text

Yes

(Empty)

SESSION="SessionName"

The session name that this activity should originate from. This allows several SQS activities to be linked to a specific session. Numerous sessions can be used within a single task. This property is active only if Session Based is selected under the Provide Credentials property.

NOTE: Use the Create Session activity to create and name an SQS session.

Description Properties

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab properties allows you to instruct a task step to react only to specific errors or ignore certain errors that should cause it to fail.

More on Error Causes properties

On Error Properties

The On Error tab properties lets you determine what the task should do if a particular step encounters an error as defined in the Error Causes properties.

More about On Error properties

Notes

Datasets

A dataset is a multiple column, multiple row container object. This activity creates and populates a dataset containing a specific set of fields in addition to the standard dataset fields. The table below describes these fields (assuming the name of the created and assigned dataset is theDataset).

Name

Type

Return Value

theDataset.Body

Text

The message's contents.

theDataset.MD5OfBody

Text

An MD5 digest of the non-URL-encoded message body string (i.e. 1c531e2d189cdcb9ec81ef36f4c22d85).

theDataset.ReceiptHandle

Text

A string associated with a specific instance of receiving the message.

theDataset.MessageID

Text

The message's SQS-assigned ID (i.e. e07cab7e-aa08-469b-aa53-73978906e0bd).

theDataset.Attribute

Text

Returns the Sender Id, sent timestamp, approximate receive count, and/or approximate first receive timestamp. The sent timestamp and approximate first receive timestamp are each returned as an integer representing the epoch time in milliseconds.

Expressions, Variables and Functions

All text fields allow the use of expressions such as variables, functions or AutoMate extended functions, which can be entered by surrounding the expression in percentage signs (example: %FileDateTime(myVar)% or %myVar%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by clicking the Insert Expression (%) button or by pressing F2.

More on expressions

More on variables

More on function

More on extended functions
More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

 

Description: Receive message from queue ""https://queue.amazonaws.com/QueueID"". Store SQS message information into dataset "theDataset". Return "2" messages. Set visibility timeout to "1260" seconds. Return "ApproximateReceiveCount" message attribute(s). Use default SQS session.

 

<AMAWSSQS ACTIVITY="receive_message" QUEUEURL="&quot;https://queue.amazonaws.com/QueueID&quot;" MAXMSG="2" TIMEOUT="1260" ATTR="ApproximateReceiveCount" RESULTDATASET="theDataset" />

 

↑ [Top of Page]