Ballerina Amazon SNS Connector
Amazon SNS is a message notification service provided by Amazon.com Inc., enabling users to publish messages to topics, which are then delivered to subscribing endpoints or clients.
The ballerinax/aws.sns
package offers APIs to connect and interact with AWS SNS API endpoints.
Quickstart
Note: Ensure you follow the prerequisites to set up the AWS SNS API.
To use the aws.sns
connector in your Ballerina application, modify the .bal
file as follows:
Step 1: Import the connector
Import the ballerinax/aws.sns
package into your Ballerina project.
import ballerinax/aws.sns;
Step 2: Instantiate a new connector
Create a sns:ConnectionConfig
record with the obtained accessKeyId
and secretAccessKey
and initialize the connector with it.
sns:ConnectionConfig config = {
accessKeyId: accessKeyId,
secretAccessKey: secretAccessKey,
region: region
};
sns:Client amazonSNSClient = check new(config);
Step 3: Invoke the connector operation
Now, utilize the available connector operations.
string topicArn = check amazonSNSClient->createTopic("FirstTopic");
For comprehensive information about the connector's functionality, configuration, and usage in Ballerina programs, refer to the aws.sns
connector's reference guide in Ballerina Central.
Set up AWS SNS API
-
Create an AWS account
For detailed steps, including necessary links, refer to the setup guide.
Issues and projects
The Issues and Projects tabs are disabled for this repository as this is part of the Ballerina library. To report bugs, request new features, start new discussions, view project boards, etc., visit the Ballerina library parent repository.
This repository only contains the source code for the package.
Build from the source
Prerequisites
-
Download and install Java SE Development Kit (JDK) version 17. You can download it from either of the following sources:
Note: After installation, remember to set the
JAVA_HOME
environment variable to the directory where JDK was installed. -
Download and install Ballerina Swan Lake.
Build options
Execute the commands below to build from the source.
-
To build the package:
./gradlew clean build
-
To run the tests:
./gradlew clean test
-
To build the without the tests:
./gradlew clean build -x test
-
To debug with the Ballerina language:
./gradlew clean build -PbalJavaDebug=<port>
-
Publish the generated artifacts to the local Ballerina Central repository:
./gradlew clean build -PpublishToLocalCentral=true
-
Publish the generated artifacts to the Ballerina Central repository:
./gradlew clean build -PpublishToCentral=true
Contribute to Ballerina
As an open-source project, Ballerina welcomes contributions from the community.
For more information, go to the contribution guidelines.
Code of conduct
All the contributors are encouraged to read the Ballerina Code of Conduct.
Useful links
- For more information go to the
aws.sns
package. - For example demonstrations of the usage, go to Ballerina By Examples.
- Chat live with us via our Discord server.
- Post all technical questions on Stack Overflow with the #ballerina tag.