July 30, 2023

tSQSQueueList – Docs for ESB 7.x

tSQSQueueList

Iterates and lists the URL of Amazon SQS (Simple Queue Service)
queues in a specified region.

Note: This component supports AWS server-side encryption (SSE)
for SQS queues.

tSQSQueueList Standard properties

These properties are used to configure tSQSQueueList running in the
Standard Job framework.

The Standard tSQSQueueList component belongs to the Cloud family.

The component in this framework is available in all Talend
products
.

Basic settings

Use an existing connection

Select this check box and in the Component List click the relevant connection component to
reuse the connection details you already defined.

Access
Key
and Secret
Key

Specify the access keys (the access key ID in the Access
Key
field and the secret access key in the Secret
Key
field) required to access the Amazon Web Services. For more
information on AWS access keys, see Access keys (access key ID and secret access key).

To enter the secret key, click the […] button next to
the secret key field, and then in the pop-up dialog box enter the password between double
quotes and click OK to save the settings.

Inherit credentials from AWS role

Select this check box to leverage the instance profile
credentials. These credentials can be used on Amazon EC2 instances, and are delivered
through the Amazon EC2 metadata service. To use this option, your Job must be running
within Amazon EC2 or other services that can leverage IAM Roles for access to resources.
For more information, see Using an IAM Role to Grant Permissions to
Applications Running on Amazon EC2 Instances
.

Assume Role

If you temporarily need some access permissions associated
to an AWS IAM role that is not granted to your user account, select this check box to
assume that role. Then specify the values for the following parameters to create a new
assumed role session.

Ensure that access to this role has been
granted to your user account by the trust policy associated to this role. If you are not
certain about this, ask the owner of this role or your AWS administrator.

  • Role ARN: the Amazon Resource Name (ARN) of the role to assume. You
    can find this ARN name on the Summary page
    of the role to be used on your AWS portal, for example, this role ARN could read
    like am:aws:iam::[aws_account_number]:role/[role_name].

  • Role session name: enter the name you want to use to uniquely
    identify your assumed role session. This name can contain upper- and lower-case
    alphanumeric characters with no spaces. You can also include underscores or any of
    the following characters: =,.@-.

  • Session duration (minutes): the duration (in minutes) for which you
    want the assumed role session to be active. This duration cannot exceed the
    maximum duration which your AWS administrator has set.

For an example about an IAM role and its related policy types, see Create and Manage AWS IAM Roles from the AWS
documentation.

Region

Specify the AWS region by selecting a region name from the
list or entering a region between double quotation marks (for example “us-east-1”) in the list. For more information on AWS Regions,
see AWS Regions and Endpoints.

Advanced settings

Config
client

Select this check box and in the table displayed specify the
client configuration parameters. Click the [+] button below the table to add as many rows as needed, each row for a
client configuration parameter, and set the value of the following attributes for each
parameter:

  • Client Parameter: click the cell and select a parameter from the
    drop-down list.

  • Value: enter the value for the corresponding parameter.

STS
Endpoint

Select this check box and in the field displayed, specify the
AWS Security Token Service endpoint, for example, sts.amazonaws.com, where session credentials are retrieved from.

This service allows you to request temporary,
limited-privilege credentials for the AWS user you authenticate; therefore, you still
need to provide the access key and secret key to authenticate the AWS account to be
used.

For a list of the STS endpoints you can use, see
AWS Security Token Service. For further information about the
STS temporary credentials, see Temporary Security Credentials. Both articles are from the AWS
documentation.

This check box is available only when the Assume role check box is selected.

tStatCatcher Statistics

Select this check box to gather the Job processing metadata at the Job level
as well as at each component level.

Global variables

CURRENT_QUEUE_NAME

The URL of the queue being processed. This is a Flow variable and it returns a
string.

NB_QUEUE

The number of queues processed. This is an After variable and it returns an
integer.

ERROR_MESSAGE

The error message generated by the component when an error occurs. This is an After
variable and it returns a string.

Usage

Usage rule

This component is usually used as a start component of a Job or
subJob and it always needs an output link.

Listing Amazon SQS queues in an AWS region

Here’s an example of using Talend components to iterate and list
the URLs of all Amazon SQS (Simple Queue Service) queues in an AWS
region.

Creating a Job for listing Amazon SQS queues

Create a Job to open a connection to access Amazon SQS, then iterate
and list the URLs of all Amazon SQS queues in a specified region, finally display the
total number of the queues in the region.

tSQSQueueList_1.png

Prerequisites: You must create several Amazon SQS
queues in an AWS region in order to replicate this scenario. In this example, four
queues talend, talend-dev,
talend-doc and talend-qa have been
created in the region Asia Pacific (Tokyo) as shown in below
figure.

tSQSQueueList_2.png

  1. Create a new Job and add a tSQSConnection component, a tSQSQueueList component, a tIterateToFlow component, a tLogRow component, and a tJava component by typing their names in the design workspace
    or dropping them from the Palette.
  2. Link the tSQSQueueList
    component to the tIterateToFlow component
    using a Row > Iterate connection.
  3. Link the tIterateToFlow
    component to the tLogRow component using a
    Row > Main connection.
  4. Link the tSQSConnection
    component to the tSQSQueueList component
    using a Trigger > OnSubjobOk connection.
  5. Link the tSQSQueueList
    component to the tJava component using a
    Trigger > OnSubjobOk connection.

Opening a connection to access Amazon SQS

Configure the tSQSConnection
component to open a connection to access Amazon SQS.

  1. Double-click the tSQSConnection
    component to open its Basic settings view.

    tSQSQueueList_3.png

  2. In the Access Key and Secret Key fields, specify the authentication
    information required to access Amazon SQS.
  3. Select an AWS region available for Amazon SQS from the Region drop-down list. In this example, it is
    Asia Pacific (Tokyo).

Listing all Amazon SQS queues in an AWS region

Configure the tSQSQueueList
component, the tIterateToFlow component, the
tLogRow component, and the tJava component to list the URLs of all Amazon SQS queues
in an AWS region and display the total number of the queues in the region on the console
of Talend Studio.

  1. Double-click the tSQSQueueList component to open its Basic settings view.

    tSQSQueueList_4.png

  2. Specify the connection details required to access Amazon SQS. In
    this example, select the Use an existing
    connection
    check box and from the Component List drop-down list displayed, select the connection
    component to reuse its connection details you have already defined.
  3. Double-click the tIterateToFlow component to open its Basic settings view.

    tSQSQueueList_5.png

  4. Click the tSQSQueueList_6.png button next to Edit schema to open the schema dialog box.

    tSQSQueueList_7.png

  5. Click the tSQSQueueList_8.png button to add one String type column
    CurrentQueueURL that will hold the URLs of the queues
    to be listed. When done, click OK to close
    the dialog box.
  6. In the Mapping table, set
    the value for the CurrentQueueURL column. In this
    example, the value is set to
    ((String)globalMap.get("tSQSQueueList_1_CURRENT_QUEUE_NAME")),
    which is the value of the global variable
    CURRENT_QUEUE_NAME for the tSQSQueueList component.

    Note that you can fill the value by pressing Ctrl + Space to access the global variables list
    and then selecting tSQSQueueList_1_CURRENT_QUEUE_NAME
    from the list.
  7. Double-click the tLogRow
    component to open its Basic settings view,
    and then select Table (print values in cells of a
    table)
    in the Mode area for
    better readability of the result.

    tSQSQueueList_9.png

  8. Double-click the tJava
    component to open its Basic settings
    view.

    tSQSQueueList_10.png

  9. In the Code field, enter the
    following code to display the total number of the queues in the region.

Executing the Job to list Amazon SQS queues

After setting up the Job and configuring the components used in the
Job for listing Amazon SQS queues, you can then execute the Job and verify the Job
execution result.

  1. Press Ctrl + S to save the
    Job.
  2. Press F6 to execute the
    Job.

    tSQSQueueList_11.png

    As shown above, the URLs of all queues in the Asia
    Pacific (Tokyo)
    region and the total number of the queues are
    displayed on the console.

Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x