Example usage for com.amazonaws.services.kinesis.model PutRecordsResult PutRecordsResult

List of usage examples for com.amazonaws.services.kinesis.model PutRecordsResult PutRecordsResult

Introduction

In this page you can find the example usage for com.amazonaws.services.kinesis.model PutRecordsResult PutRecordsResult.

Prototype

PutRecordsResult

Source Link

Usage

From source file:com.facebook.presto.kinesis.util.MockKinesisClient.java

License:Apache License

@Override
public PutRecordsResult putRecords(PutRecordsRequest putRecordsRequest)
        throws AmazonServiceException, AmazonClientException {
    // Setup method to add a batch of new records:
    InternalStream theStream = this.getStream(putRecordsRequest.getStreamName());
    if (theStream != null) {
        PutRecordsResult result = new PutRecordsResult();
        ArrayList<PutRecordsResultEntry> resultList = new ArrayList<PutRecordsResultEntry>();
        for (PutRecordsRequestEntry entry : putRecordsRequest.getRecords()) {
            PutRecordResult putResult = theStream.putRecord(entry.getData(), entry.getPartitionKey());
            resultList.add((new PutRecordsResultEntry()).withShardId(putResult.getShardId())
                    .withSequenceNumber(putResult.getSequenceNumber()));
        }/*from w ww . j a va 2 s. c  o m*/

        result.setRecords(resultList);
        return result;
    } else {
        throw new AmazonClientException("This stream does not exist!");
    }
}