public abstract class AbstractKinesisRecorder extends Object
Modifier and Type | Field and Description |
---|---|
protected KinesisRecorderConfig |
config
The configurable options for Kinesis Recorder, includes the
ClientConfiguration of the low level client.
|
protected com.amazonaws.mobileconnectors.kinesis.kinesisrecorder.FileRecordStore |
recordStore |
Modifier | Constructor and Description |
---|---|
protected |
AbstractKinesisRecorder(com.amazonaws.mobileconnectors.kinesis.kinesisrecorder.FileRecordStore recordStore,
KinesisRecorderConfig config)
Creates a
AbstractKinesisRecorder . |
Modifier and Type | Method and Description |
---|---|
void |
deleteAllRecords()
Removes all requests saved to disk in the directory provided this
KinesisRecorder.
|
long |
getDiskByteLimit()
Returns the max number of bytes that this Kinesis Recorder will store on
disk.
|
long |
getDiskBytesUsed()
Returns the number of bytes KinesisRecorder currently has stored in the
directory passed in the constructor.
|
KinesisRecorderConfig |
getKinesisRecorderConfig()
Returns the KinesisRecorderConfig this Kinesis Recorder is using.
|
protected abstract com.amazonaws.mobileconnectors.kinesis.kinesisrecorder.RecordSender |
getRecordSender()
Gets the sender to send saved records.
|
protected String |
nextBatch(com.amazonaws.mobileconnectors.kinesis.kinesisrecorder.FileRecordStore.RecordIterator iterator,
List<byte[]> data,
int maxCount,
int maxSize)
Reads a batch of records belong to the same stream into a list.
|
void |
saveRecord(byte[] data,
String streamName)
Saves a record to local storage to be sent later.
|
void |
saveRecord(String data,
String streamName)
Saves a string to local storage to be sent later.
|
void |
submitAllRecords()
Submits all requests saved to Amazon Kinesis.
|
protected KinesisRecorderConfig config
protected com.amazonaws.mobileconnectors.kinesis.kinesisrecorder.FileRecordStore recordStore
protected AbstractKinesisRecorder(com.amazonaws.mobileconnectors.kinesis.kinesisrecorder.FileRecordStore recordStore, KinesisRecorderConfig config)
AbstractKinesisRecorder
.recordStore
- local file store that keeps Kinesis recordsconfig
- configurationprotected abstract com.amazonaws.mobileconnectors.kinesis.kinesisrecorder.RecordSender getRecordSender()
RecordSender
public void saveRecord(String data, String streamName)
data
- A string to submit to the streamstreamName
- The stream to submit the data to.public void saveRecord(byte[] data, String streamName)
data
- The data to submit to the streamstreamName
- The stream to submit the data to.public void submitAllRecords()
AmazonClientException
- Thrown if there was an unrecoverable error
during submission. Note: If the request appears to be
invalid, the record will be deleted. If the request appears
to be valid, it will be kept.protected String nextBatch(com.amazonaws.mobileconnectors.kinesis.kinesisrecorder.FileRecordStore.RecordIterator iterator, List<byte[]> data, int maxCount, int maxSize)
iterator
- record iteratordata
- a list to hold data.maxCount
- maximum number of records in a batchmaxSize
- a threshold that concludes a batch. It allows one extra
record that brings the total size over this threshold.public KinesisRecorderConfig getKinesisRecorderConfig()
public long getDiskBytesUsed()
public long getDiskByteLimit()
public void deleteAllRecords()
Copyright © 2017. All rights reserved.