@Override public PublishResult publish(String topicArn, String message) { return publish(new PublishRequest().withTopicArn(topicArn).withMessage(message)); }
private <T extends Serializable> void sendMessageToAllRegionsSync(final T body) throws IOException { if ( sns == null ) { logger.error( "SNS client is null, perhaps it failed to initialize successfully" ); return; } final String stringBody = toString( body ); String topicArn = getWriteTopicArn(); if ( logger.isTraceEnabled() ) { logger.trace( "Publishing Message...{} to arn: {}", stringBody, topicArn ); } try { PublishResult publishResult = sns.publish(topicArn, toString(body)); if ( logger.isTraceEnabled() ) { logger.trace( "Successfully published... messageID=[{}], arn=[{}]", publishResult.getMessageId(), topicArn ); } } catch (Exception e) { if (logger.isErrorEnabled()) { logger.error(FAILED_TO_SEND_MESSAGE, stringBody, topicArn, e); } sendMessageToAllRegionsAsync(body); } }
@Override public PublishResult publish(String topicArn, String message, String subject) { return publish(new PublishRequest().withTopicArn(topicArn).withMessage(message).withSubject(subject)); }
client.publish(request); session.transfer(flowFile, REL_SUCCESS); session.getProvenanceReporter().send(flowFile, arn);
publishRequest.setTopicArn(topicArn); publishRequest.setMessage(message); return publish(publishRequest);
public static void sendNotification(AmazonSNSClient snsClient, String notificationARN, String subject, String message) { snsClient.publish(notificationARN, message, subject); } }
publishRequest.setMessage(message); publishRequest.setSubject(subject); return publish(publishRequest);
public static boolean publish(String arn, String msg, AmazonSNSClient snsClient, String s3Key) { if (dryRun) { logger.warn("would have published " + s3Key + " S3 creation event to SNS"); return true; } logger.info("publishing " + s3Key + " S3 creation event to SNS"); try { snsClient.publish(arn, msg, "Amazon S3 Notification"); } catch (RuntimeException e) { logger.error("error publishing", e); return false; } return true; }
public void send(boolean fromMaster, CCPayloadType type, String onlyForHostOrIp, Object value) throws Exception { CCPayload payload = new CCPayload(); payload.fromMaster = fromMaster; payload.type = type; payload.value = value; payload.onlyForHostIdOrIP = onlyForHostOrIp; payload.sourceHostId = this.mySourceIdentifier.trim(); payload.sourceHostIP = this.mySourceIp; logger.debug("Sending: " + type + "="+value); // send! this.snsClient.publish(this.snsTopicARN, gson.toJson(payload)); }
sns.publish(publishRequest); logger.debug("event=publish topic_arn=" + topicArn + " user_id= " + userId);
@Override public void onException(Exception e) { /* * Always close the iterator to prevent connection leaking */ try { if (this.recordIterator != null) { this.recordIterator.close(); } } catch (IOException e1) { logger.error("unable to close record iterator", e); } if (this.config == null || this.config.getHandlerConfig() == null) { return; } /* * Notify SNS topic */ SNSS3HandlerConfig handlerConfig = (SNSS3HandlerConfig) this.config.getHandlerConfig(); if (handlerConfig.getSnsNotificationArn() != null) { AmazonSNSClient snsClient = this.snsClientFactory.newInstance(); snsClient.publish(handlerConfig.getSnsNotificationArn(), this.inputFiles.stream().map(Object::toString).collect(Collectors.joining(",")), "SNSS3Handler Failed"); } }
@Override public void onException(Exception e) { /* * Always close the iterator to prevent connection leaking */ try { if (this.recordIterator != null) { this.recordIterator.close(); } } catch (IOException e1) { logger.error("unable to close record iterator", e); } if (this.config == null || this.config.getHandlerConfig() == null) { return; } /* * Notify SNS topic */ SNSS3HandlerConfig handlerConfig = (SNSS3HandlerConfig) this.config.getHandlerConfig(); if (handlerConfig.getSnsNotificationArn() != null) { AmazonSNSClient snsClient = this.snsClientFactory.newInstance(); snsClient.publish(handlerConfig.getSnsNotificationArn(), this.inputFiles.stream().map(Object::toString).collect(Collectors.joining(",")), "SNSS3Handler Failed"); } }
publishRequest.setTopicArn(topicArn); publishRequest.setMessage(message); return publish(publishRequest);
publishRequest.setMessage(message); publishRequest.setSubject(subject); return publish(publishRequest);
ul.getObjectMapper().writeValueAsString(productInfo), productInfo.getName()); ingestor.getSNSClient().publish(snsPublishRequest); } catch (Exception ex) { logger.error("Failed to send newProduct SNS notification!",ex);
client.publish(request); session.transfer(flowFile, REL_SUCCESS); session.getProvenanceReporter().send(flowFile, arn);