@NotThreadSafe public class AggRecord extends Object
Constructor and Description |
---|
AggRecord()
Construct a new (empty) aggregated Kinesis record.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addUserRecord(String partitionKey,
String explicitHashKey,
byte[] data)
Add a new user record to this existing aggregated record if there is enough
space (based on the defined Kinesis limits for a PutRecord call).
|
void |
clear()
Clears out all records and metadata from this object so that it can be reused
just like a fresh instance of this object.
|
String |
getExplicitHashKey()
Get the overarching explicit hash key for the entire aggregated record.
|
int |
getNumUserRecords()
Get the current number of user records contained inside this aggregate
record.
|
String |
getPartitionKey()
Get the overarching partition key for the entire aggregated record.
|
int |
getSizeBytes()
Get the current size in bytes of the fully serialized aggregated record.
|
com.amazonaws.services.kinesis.model.PutRecordRequest |
toPutRecordRequest(String streamName)
Convert the aggregated data in this record into a single PutRecordRequest.
|
com.amazonaws.services.kinesis.model.PutRecordsRequestEntry |
toPutRecordsRequestEntry()
Convert the aggregated data in this record into a single
PutRecordsRequestEntry.
|
byte[] |
toRecordBytes()
Serialize this record to bytes.
|
public int getNumUserRecords()
public int getSizeBytes()
public byte[] toRecordBytes()
public void clear()
public String getPartitionKey()
public String getExplicitHashKey()
public boolean addUserRecord(String partitionKey, String explicitHashKey, byte[] data)
partitionKey
- The partition key of the new user record to addexplicitHashKey
- The explicit hash key of the new user record to adddata
- The raw data of the new user record to addpublic com.amazonaws.services.kinesis.model.PutRecordRequest toPutRecordRequest(String streamName)
streamName
- The Kinesis stream name where this PutRecordRequest will be sent.public com.amazonaws.services.kinesis.model.PutRecordsRequestEntry toPutRecordsRequestEntry()
Copyright © 2019. All rights reserved.