Search in sources :

Example 1 with PutRecordRequest

use of com.amazonaws.services.kinesisfirehose.model.PutRecordRequest in project camel by apache.

the class KinesisFirehoseProducer method process.

@Override
public void process(Exchange exchange) throws Exception {
    PutRecordRequest request = createRequest(exchange);
    log.trace("Sending request [{}] from exchange [{}]...", request, exchange);
    PutRecordResult putRecordResult = getEndpoint().getClient().putRecord(request);
    log.trace("Received result [{}]", putRecordResult);
    Message message = getMessageForResponse(exchange);
    message.setHeader(KinesisFirehoseConstants.RECORD_ID, putRecordResult.getRecordId());
}
Also used : PutRecordResult(com.amazonaws.services.kinesisfirehose.model.PutRecordResult) Message(org.apache.camel.Message) PutRecordRequest(com.amazonaws.services.kinesisfirehose.model.PutRecordRequest)

Example 2 with PutRecordRequest

use of com.amazonaws.services.kinesisfirehose.model.PutRecordRequest in project camel by apache.

the class KinesisFirehoseProducer method createRequest.

private PutRecordRequest createRequest(Exchange exchange) {
    ByteBuffer body = exchange.getIn().getBody(ByteBuffer.class);
    Record record = new Record();
    record.setData(body);
    PutRecordRequest putRecordRequest = new PutRecordRequest();
    putRecordRequest.setDeliveryStreamName(getEndpoint().getStreamName());
    putRecordRequest.setRecord(record);
    return putRecordRequest;
}
Also used : PutRecordRequest(com.amazonaws.services.kinesisfirehose.model.PutRecordRequest) Record(com.amazonaws.services.kinesisfirehose.model.Record) ByteBuffer(java.nio.ByteBuffer)

Aggregations

PutRecordRequest (com.amazonaws.services.kinesisfirehose.model.PutRecordRequest)2 PutRecordResult (com.amazonaws.services.kinesisfirehose.model.PutRecordResult)1 Record (com.amazonaws.services.kinesisfirehose.model.Record)1 ByteBuffer (java.nio.ByteBuffer)1 Message (org.apache.camel.Message)1