use of software.amazon.awssdk.services.sns.SnsClient in project aws-doc-sdk-examples by awsdocs.
the class PublishTopic method main.
/**
* To run this Java V2 code example, ensure that you have setup your development environment, including your credentials.
*
* For information, see this documentation topic:
*
* https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html
*/
public static void main(String[] args) {
final String USAGE = "\n" + "Usage: " + " <message> <topicArn>\n\n" + "Where:\n" + " message - the message text to send.\n\n" + " topicArn - the ARN of the topic to publish.\n\n";
if (args.length != 2) {
System.out.println(USAGE);
System.exit(1);
}
String message = args[0];
String topicArn = args[1];
SnsClient snsClient = SnsClient.builder().region(Region.US_WEST_2).build();
pubTopic(snsClient, message, topicArn);
snsClient.close();
}
Aggregations