Example usage for com.amazonaws.services.kinesis.model PutRecordsRequestEntry getPartitionKey

List of usage examples for com.amazonaws.services.kinesis.model PutRecordsRequestEntry getPartitionKey

Introduction

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

Prototype


public String getPartitionKey() 

Source Link

Document

Determines which shard in the stream the data record is assigned to.

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  w w  . ja va2 s. c  om

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