Skip to Content

Amazon SQS Get Messages Activity

Introduction

An Amazon SQS Get Messages activity, using its Amazon SQS connection, retrieves all Amazon SQS messages available in a specific queue and is intended to be used as a source in an operation.

This activity uses the ReceiveMessage action from the Amazon SQS API.

Prerequisites

To successfully use this activity, you must have the following AWS IAM account permissions:

  • sqs:GetQueueUrl
  • sqs:ListQueues
  • sqs:ReceiveMessage

Cross-account permissions don't apply to this action. For more information, see Basic Examples of Amazon SQS Policies in the Amazon SQS Developer Guide.

Create an Amazon SQS Get Messages Activity

An instance of an Amazon SQS Get Messages activity is created from an Amazon SQS connection using its Get Messages activity type.

To create an instance of an activity, drag the activity type to the design canvas or copy the activity type and paste it on the design canvas. For details, see Creating an Activity Instance in Component Reuse.

An existing Amazon SQS Get Messages activity can be edited from these locations:

Configure an Amazon SQS Get Messages Activity

Follow these steps to configure an Amazon SQS Get Messages activity:

Step 1: Enter a Name, Select a Queue, and Specify Settings

In this step, provide a name for the activity, select a queue, and specify the settings for receiving messages.

Amazon SQS Get Messages Activity Configuration Step 1

Tip

Fields with a variable icon Variable icon support using global variables, project variables, and Jitterbit variables. Begin either by typing an open square bracket [ into the field or by clicking the variable icon to display a list of the existing variables to choose from.

  • Name: Enter a name to identify the activity. The name must be unique for each Amazon SQS Get Messages activity and must not contain forward slashes (/) or colons (:).

  • Select a Queue: This section displays queues available in the Amazon SQS endpoint. When reopening an existing activity configuration, only the selected queue is displayed instead of reloading the entire queue list.

    • Selected Queue: After a queue is selected, it is listed here.

    • Search: Enter any part of the queue name into the search box to filter the list of queues. The search is not case-sensitive. If queues are already displayed within the table, the table results are filtered in real time with each keystroke. To reload queues from the endpoint when searching, enter search criteria and then refresh, as described below.

    • Refresh: Click the refresh icon Refresh icon or the word Refresh to reload queues from the Amazon SQS endpoint. This may be useful if queues have been added to Amazon SQS. This action refreshes all metadata used to build the table of queues displayed in the configuration.

    • Selecting a Queue: Within the table, click anywhere on a row to select a queue. Only one queue can be selected. The information available for each queue is fetched from the Amazon SQS endpoint:

      • Name: The queue name from Amazon SQS.

      • Description: The queue description from Amazon SQS.

    Tip

    If the table does not populate with available queues, the Amazon SQS connection may not be successful. Ensure you are connected by reopening the connection and retesting the credentials.

  • Receive Request Attempt ID: Enter the receive request attempt ID. It is a token used for message deduplication.

  • Visibility Timeout: Enter the length of time that a message received from a queue (by one consumer) won't be visible to the other message consumers. This can range from 0 to 43,200 seconds. For more information, see Amazon SQS Visibility Timeout.

  • Wait Time Seconds: Enter the maximum amount of time that Amazon SQS waits for messages to become available after the queue gets a receive request. For more information, see Amazon SQS Short and Long Polling.

  • Max Number of Messages: Enter the maximum number of messages to retrieve. This can range from 1 to 10 messages.

  • Auto-Delete Messages From Queue: Select to automatically delete received messages from the queue. It is selected by default.

  • Continue on Error: Select to continue the activity execution if an error is encountered for a dataset in a batch request. If any errors are encountered, they are written to the operation log. It is selected by default.

  • Save & Exit: If enabled, click to save the configuration for this step and close the activity configuration.

  • Next: Click to temporarily store the configuration for this step and continue to the next step. The configuration will not be saved until you click the Finished button on the last step.

  • Discard Changes: After making changes, click to close the configuration without saving changes made to any step. A message asks you to confirm that you want to discard changes.

Step 2: Review the Data Schemas

Any request or response schemas generated from the endpoint are displayed.

Amazon SQS Get Messages Activity Configuration Step 2

  • Data Schemas: These data schemas are inherited by adjacent transformations and are displayed again during transformation mapping.

    Note

    Data supplied in a transformation takes precedence over the activity configuration.

    The Amazon SQS connector uses the AWS SDK for Java version 1.12.522. Refer to the API documentation for information on the schema nodes and fields.

    The request and response data schemas consist of these nodes and fields:

    • Request:

      Request Schema Node/Field Amazon SQS API Field/Method Description
      GetMessagesRequest ReceiveMessageRequest Request to retrieve messages from a queue
      request N/A (Request Node) Node representing the request
      attributeNames AttributeName (List) List of attributes to retrieve along with messages
      #text Set to All by default, see API Message reference for applicable values
      maxNumberOfMessages MaxNumberOfMessages Integer with the maximum number of messages to retrieve
      messageAttributeNames MessageAttributeName (List) List of attributes to retrieve within each message
      #text Set to All by default, see API Message reference for applicable values
      queueUrl QueueUrl String with the URL of the queue to get messages from
      receiveRequestAttemptId ReceiveRequestAttemptId String with a token used for FIFO queue message deduplication
      visibilityTimeout VisibilityTimeout Integer with the messages' visibility timeout settings in seconds
      waitTimeSeconds WaitTimeSeconds Integer with the length of time to wait for messages in seconds
      autoDeleteMessages N/A Boolean that determines whether or not to delete messages after retrieval
    • Response:

      Response Schema Node/Field Amazon SQS API Field/Method Description
      GetMessagesRequest ReceiveMessageResponse Response from retrieving messages from a queue
      response N/A (Response Node) Node representing the response
      errorMessage N/A (Response Message) String set to the response's error message
      autoDeleteStatus N/A String set to the auto delete result status
      messages Message (List) List of messages returned with the response
      body Body String set to the body of the message
      mD5OfBody MD5OfBody String set to the MD5 digest of the non-URL-encoded message body
      mD5OfMessageAttributes MD5OfMessageAttributes String set to the MD5 digest of the non-URL-encoded message attributes
      messageAttributes Attribute (List) List of attributes associated with message
      attrName Name String set to the name of the attribute
      stringValue Value String set to the value of the attribute
      dataType Type String set to the data type of the attribute
      messageId MessageId String set to the message's unique identifier
      receiptHandle ReceiptHandle String set the receipt handle associated with the message

    Note

    Refer to the ReceiveMessage action for detailed information on the schema nodes and fields.

  • Refresh: Click the refresh icon Refresh icon or the word Refresh to regenerate schemas from the Amazon SQS endpoint. This action also regenerates a schema in other locations throughout the project where the same schema is referenced, such as in an adjacent transformation.

  • Back: Click to temporarily store the configuration for this step and return to the previous step.

  • Finished: Click to save the configuration for all steps and close the activity configuration.

  • Discard Changes: After making changes, click to close the configuration without saving changes made to any step. A message asks you to confirm that you want to discard changes.

Next Steps

After configuring an Amazon SQS Get Messages activity, complete the configuration of the operation by adding and configuring other activities, transformations, or scripts as operation steps. You can also configure the operation settings, which include the ability to chain operations together that are in the same or different workflows.

Menu actions for an activity are accessible from the project pane and the design canvas. For details, see Activity Actions Menu in Connector Basics.

Amazon SQS Get Messages activities can be used as a source with these operation patterns:

To use the activity with scripting functions, write the data to a temporary location and then use that temporary location in the scripting function.

When ready, deploy and run the operation and validate behavior by checking the operation logs.