See: Description
Interface | Description |
---|---|
DeadLetterListener |
Interface to receive undeliverable kinesis data to further process or submit through other means.
This may be re-evaluating the data and stream name or packaging the data to be sent to S3. The data sent here either encountered errors that cannot be retried or exceeded the retry limit. This is set using KinesisRecorderConfig.withDeadLetterListener(DeadLetterListener) . |
Class | Description |
---|---|
AbstractKinesisRecorder |
An abstract class for Amazon Kinesis recorders.
|
KinesisFirehoseRecorder |
The
KinesisFirehoseRecorder is a high level client for Amazon Kinesis
Firehose. |
KinesisRecorder |
The KinesisRecorder is a high level client meant for storing records on the
users Android device.
|
KinesisRecorderConfig |
Allows configuration of certain KinesisRecorder parameters, such as
maxStoargeSize.
|
KinesisRecorder and KinesisFirehoseRecorder are high level clients for Amazon Kinesis. They offer storing records on the users Android device before sending to the server. This allows developers to retain requests when the device is offline. It can also increase performance and battery efficiency since the wi-fi or cell network does not need to be woken up as frequently.
KinesisRecorder and KinesisFirehoseRecorder are very similar. The main difference is the destination. KinesisRecorder sends data to Amazon Kinesis Streams and developer needs to write applications to process streamed data from the service. Whereas the latter sends data to Amazon Kinesis Firehose which is a fully managed service for delivering real-time streaming data to destinations such as Amazon Simple Storage Service (Amazon S3) and Amazon Redshift.
The following is an example of KinesisFirehoseRecorder.
// working directory for the recorder File directory = context.getCachedDir(); // AWS Firehose region Regions region = Regions.US_WEST_2; // initialize a credentials provider AWSCredentialsProvider provider = new CognitoCachingCredentialsProvider( context, "identityPoolId", Regions.US_EAST_1); KinesisFirehoseRecorder firehoseRecorder = new KinesisFirehoseRecorder( directory, region, provider); // save some strings String streamName = "my_stream"; // Firehose delivery stream name firehoseRecorder.saveRecord("Hello world!\n", streamName); firehoseRecorder.saveRecord("Streaming data to S3 via Firehose is easy.\n", streamName); // send previously save data to Amazon Firehose // Note: submitAllRecords() makes network calls, so wrap it in an AsyncTask. new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... v) { try { firehoseRecorder.submitAllRecords(); } catch (AmazonClientException ace) { // error occurs. } } }.execute();
Copyright © 2018 Amazon Web Services, Inc. All Rights Reserved.