List of usage examples for com.amazonaws.services.sns AmazonSNS publish
PublishResult publish(String topicArn, String message);
From source file:ca.paullalonde.gocd.sns_plugin.executors.StageStatusRequestExecutor.java
License:Apache License
protected void sendNotification() throws Exception { PluginSettings pluginSettings = pluginRequest.getPluginSettings(); String topic = pluginSettings.getTopic(); if ((topic != null) && !topic.isEmpty()) { AmazonSNS sns = makeSns(pluginSettings); try {/*from w ww .j a v a 2s .c o m*/ sns.publish(topic, request.toJSON()); } catch (AmazonServiceException e) { String message = String.format( "StageStatusRequestExecutor : Cannot publish to SNS topic, error code = '%s', message = '%s'.", e.getErrorCode(), e.getErrorMessage()); LOG.error(message); } catch (AmazonClientException e) { String message = String.format( "StageStatusRequestExecutor : Cannot publish to SNS topic, message = '%s'.", e.getMessage()); LOG.error(message); } } else { LOG.debug("StageStatusRequestExecutor : Cannot publish to SNS because the topic is missing."); } }