use of software.amazon.awssdk.services.sns.model.CreateTopicRequest in project aws-doc-sdk-examples by awsdocs.
the class CreateTopic method createSNSTopic.
// snippet-start:[sns.java2.CreateTopic.main]
public static String createSNSTopic(SnsClient snsClient, String topicName) {
CreateTopicResponse result = null;
try {
CreateTopicRequest request = CreateTopicRequest.builder().name(topicName).build();
result = snsClient.createTopic(request);
return result.topicArn();
} catch (SnsException e) {
System.err.println(e.awsErrorDetails().errorMessage());
System.exit(1);
}
return "";
}
Aggregations