@NotThreadSafe public class RecordAggregator extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
RecordAggregator.RecordCompleteListener
A listener interface for receiving notifications when this aggregated
record has reached its maximum allowable size.
|
Constructor and Description |
---|
RecordAggregator()
Construct a new empty record aggregator instance.
|
Modifier and Type | Method and Description |
---|---|
AggRecord |
addUserRecord(String partitionKey,
byte[] data)
Add a new user record to this aggregated record (will trigger a callback
via onRecordComplete if aggregated record is full).
|
AggRecord |
addUserRecord(String partitionKey,
String explicitHashKey,
byte[] data)
Add a new user record to this aggregated record (will trigger a callback
via onRecordComplete if aggregated record is full).
|
AggRecord |
addUserRecord(com.amazonaws.services.kinesis.clientlibrary.types.UserRecord userRecord)
Add a new user record to this aggregated record (will trigger a callback
via onRecordComplete if aggregated record is full).
|
AggRecord |
clearAndGet()
Get the current contents of this aggregated record (whether full or not)
as a single record and then clear the contents of this object so it can
be re-used.
|
void |
clearListeners()
Clear all the listeners from this object that were registered with the
onRecordComplete method.
|
void |
clearRecord()
Clear all the user records from this aggregated record and reset it to an
empty state.
|
int |
getNumUserRecords() |
long |
getSizeBytes() |
void |
onRecordComplete(RecordAggregator.RecordCompleteListener listener)
Register a callback method to be notified when there is a full aggregated
record available.
|
void |
onRecordComplete(RecordAggregator.RecordCompleteListener listener,
Executor executor)
Register a callback method to be notified when there is a full aggregated
record available and invoke the callback using the specified executor.
|
public RecordAggregator()
public int getNumUserRecords()
public long getSizeBytes()
public void clearRecord()
public void clearListeners()
public void onRecordComplete(RecordAggregator.RecordCompleteListener listener)
listener
- The listener to receive a callback when there is a complete
aggregated record available (can be a lambda function).public void onRecordComplete(RecordAggregator.RecordCompleteListener listener, Executor executor)
listener
- The listener to receive a callback when there is a complete
aggregated record available (can be a lambda function).executor
- The executor to use to execute the callback.public AggRecord clearAndGet()
public AggRecord addUserRecord(com.amazonaws.services.kinesis.clientlibrary.types.UserRecord userRecord) throws Exception
userRecord
- The Kinesis user record to add to this aggregated recordException
- If the user record can't be added to the current agg recordpublic AggRecord addUserRecord(String partitionKey, byte[] data) throws Exception
partitionKey
- The partition key of the record to adddata
- The record data of the record to addException
- If the user record can't be added to the current agg recordpublic AggRecord addUserRecord(String partitionKey, String explicitHashKey, byte[] data) throws Exception
partitionKey
- The partition key of the record to addexplicitHashKey
- The explicit hash key of the record to adddata
- The record data of the record to addException
- If the user record can't be added to the current agg recordCopyright © 2019. All rights reserved.