Search in sources :

Example 1 with PublishResult

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;
}
Also used : PublishResult(com.amazonaws.services.sns.model.PublishResult)

Example 2 with 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);
    }
}
Also used : PublishResult(com.amazonaws.services.sns.model.PublishResult) Timer(com.netflix.spectator.api.Timer)

Example 3 with PublishResult

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());
}
Also used : PublishResult(com.amazonaws.services.sns.model.PublishResult) Message(org.apache.camel.Message) PublishRequest(com.amazonaws.services.sns.model.PublishRequest)

Aggregations

PublishResult (com.amazonaws.services.sns.model.PublishResult)3 PublishRequest (com.amazonaws.services.sns.model.PublishRequest)1 Timer (com.netflix.spectator.api.Timer)1 Message (org.apache.camel.Message)1