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

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

Introduction

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

Prototype

PutRecordsResultEntry

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  .  ja  v  a2s .com

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