ballerinax/aws.sqs Ballerina library

3.1.0

Overview

Ballerina connector for Amazon SQS connects the Amazon SQS API via Ballerina language with ease. It provides capability to perform operations related to queues and messages.

This module supports Amazon SQS API version 2012-11-05.

Prerequisites

Before using this connector in your Ballerina application, complete the following:

  • Create an AWS account
  • Obtain tokens - Follow this link to obtain Access key ID, Secret access key, Region and Account number from navigation pane Users and selecting Security credentials tab.

Quickstart

To use the Amazon SQS connector in your Ballerina application, update the .bal file as follows:

Step 1: Import connector

Import the ballerinax/aws.sqs module into the Ballerina project as follows.

Copy
import ballerinax/aws.sqs;

Step 2: Create a new connector instance

You can now enter the credentials in the SQS client configuration and create the SQS client by passing the configuration as follows.

Copy
sqs:ConnectionConfig configuration = {
    accessKey: "<ACCESS_KEY_ID>",
    secretKey: "<SECRET_ACCESS_KEY>",
    region: "<REGION>"
};

sqs:Client sqsClient = check new (configuration);

Step 3: Invoke connector operation

  1. You can create a queue in SQS as follows with createQueue method for a preferred queue name and the required set of attributes.

    Copy
    QueueAttributes queueAttributes = {  
        visibilityTimeout : 400,
        fifoQueue : true
    };
    CreateQueueResponse|error response = sqsClient->createQueue("demo.fifo", queueAttributes);
    if (response is CreateQueueResponse) {
        string queueResponse = response.createQueueResult.queueUrl;
        log:printInfo("Created queue URL: " + queueResponse);
    }
  2. Use bal run command to compile and run the Ballerina program.

You can find more samples here

Import

import ballerinax/aws.sqs;Copy

Metadata

Released date: over 1 year ago

Version: 3.1.0

License: Apache-2.0


Compatibility

Platform: java11

Ballerina version: 2201.4.1


Pull count

Total: 2419

Current verison: 13


Weekly downloads


Source repository


Keywords

IT Operations/Message Brokers

Cost/Freemium

Vendor/Amazon


Contributors