Code Monkey home page Code Monkey logo

module-amazonsqs's Introduction

Build Status

Ballerina Amazon SQS Connector

Amazon SQS Connector allows you to connect to the Amazon Simple Queue Service (SQS) via REST API from Ballerina.

Compatibility

Ballerina Language Version Amazon SQS API version
1.0.1 2012-11-05

The following sections provide you with information on how to use the Ballerina Amazon SQS connector.

Contribute To develop

Clone the repository by running the following command

git clone https://github.com/wso2-ballerina/module-amazonsqs.git

Working with Amazon SQS Connector

First, import the wso2/amazonsqs module into the Ballerina project.

import wso2/amazonsqs;

In order for you to use the Amazon SQS Connector, first you need to create an Amazon SQS Client.

Ballerina provides a config module to obtain parameters from the configuration file. Specify the configuration object and create the client as follows.

amazonsqs:Configuration configuration = {
    accessKey: config:getAsString("ACCESS_KEY_ID"),
    secretKey: config:getAsString("SECRET_ACCESS_KEY"),
    region: config:getAsString("REGION"),
    accountNumber: config:getAsString("ACCOUNT_NUMBER")
};

amazonsqs:Client sqsClient = new(configuration);
Sample
import ballerina/log;
import wso2/amazonsqs;

// Add the SQS credentials as the Configuration
amazonsqs:Configuration configuration = {
    accessKey: "<ACCESS_KEY>",
    secretKey: "<SECRET_ACCESS>",
    region: "<REGION>",
    accountNumber: "<ACCOUNT_NUMBER>"
};

amazonsqs:Client sqsClient = new(configuration);

public function main(string... args) {

    // Create a new SQS Standard queue named "newQueue"
    map<string> attributes = {};
    string|error response = sqsClient->createQueue("newQueue", attributes);
    if (response is string) {
        log:printInfo("Created queue URL: " + response);
    } else {
        log:printInfo("Error while creating a queue");
    }

}

module-amazonsqs's People

Contributors

maninda avatar maheshika avatar asitha avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.