use of com.amazonaws.services.sns.model.PublishResult in project camel by apache.
the class AmazonSNSClientMock method publish.
@Override
public PublishResult publish(PublishRequest publishRequest) throws AmazonServiceException, AmazonClientException {
PublishResult publishResult = new PublishResult();
publishResult.setMessageId("dcc8ce7a-7f18-4385-bedd-b97984b4363c");
return publishResult;
}
use of com.amazonaws.services.sns.model.PublishResult in project metacat by Netflix.
the class SNSNotificationServiceImpl method publishNotification.
private void publishNotification(final String arn, final SNSMessage<?> message) throws JsonProcessingException {
try {
final PublishResult result = this.client.publish(arn, this.mapper.writeValueAsString(message));
log.debug("Successfully published message {} to topic {} with id {}", message, arn, result.getMessageId());
} finally {
final Timer timer = this.registry.timer(Metrics.TimerNotificationsPublishDelay.name(), "type", message.getClass().getName());
timer.record(System.currentTimeMillis() - message.getTimestamp(), TimeUnit.MILLISECONDS);
}
}
use of com.amazonaws.services.sns.model.PublishResult in project camel by apache.
the class SnsProducer method process.
public void process(Exchange exchange) throws Exception {
PublishRequest request = new PublishRequest();
request.setTopicArn(getConfiguration().getTopicArn());
request.setSubject(determineSubject(exchange));
request.setMessageStructure(determineMessageStructure(exchange));
request.setMessage(exchange.getIn().getBody(String.class));
request.setMessageAttributes(this.translateAttributes(exchange.getIn().getHeaders(), exchange));
LOG.trace("Sending request [{}] from exchange [{}]...", request, exchange);
PublishResult result = getEndpoint().getSNSClient().publish(request);
LOG.trace("Received result [{}]", result);
Message message = getMessageForResponse(exchange);
message.setHeader(SnsConstants.MESSAGE_ID, result.getMessageId());
}
Aggregations