Search in sources :

Example 1 with PublishRequest

use of com.amazonaws.services.sns.model.PublishRequest 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

PublishRequest (com.amazonaws.services.sns.model.PublishRequest)1 PublishResult (com.amazonaws.services.sns.model.PublishResult)1 Message (org.apache.camel.Message)1