MCPcopy Create free account
hub / github.com/awsdocs/aws-doc-sdk-examples / main

Method main

java/example_code/sns/PublishSmsToTopic.java:6–19  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

4
5// snippet-start:[sns.java.publish_sms_to_topic.main]
6public static void main(String[] args) {
7 AmazonSNSClient snsClient = new AmazonSNSClient();
8
9 String topicArn = createSNSTopic(snsClient);
10 String phoneNumber = "+1XXX5550100";
11 // Specify a protocol of "sms" when subscribing a phone number.
12 subscribeToTopic(snsClient, topicArn, "sms", phoneNumber);
13
14 String message = "My SMS message";
15 Map<String, MessageAttributeValue> smsAttributes =
16 new HashMap<String, MessageAttributeValue>();
17 addMessageAttributes(smsAttributes)
18 sendSMSMessageToTopic(snsClient, topicArn, message, smsAttributes);
19}
20// snippet-end:[sns.java.publish_sms_to_topic.main]
21
22// snippet-start:[sns.java.publish_sms_to_topic.create_topic]

Callers 6

test_main_successFunction · 0.45
test_main_failureFunction · 0.45
test_main_invalid_s3_uriFunction · 0.45
test_run_integFunction · 0.45

Calls 4

subscribeToTopicMethod · 0.80
addMessageAttributesMethod · 0.80
sendSMSMessageToTopicMethod · 0.80
createSNSTopicMethod · 0.45

Tested by 4

test_main_successFunction · 0.36
test_main_failureFunction · 0.36
test_main_invalid_s3_uriFunction · 0.36
test_run_integFunction · 0.36