public class KinesisRecordProcessor extends Object implements com.amazonaws.services.kinesis.clientlibrary.interfaces.IRecordProcessor, Logging
Constructor and Description |
---|
KinesisRecordProcessor(KinesisReceiver receiver,
String workerId,
KinesisCheckpointState checkpointState) |
Modifier and Type | Method and Description |
---|---|
void |
initialize(String shardId)
The Kinesis Client Library calls this method during IRecordProcessor initialization.
|
void |
processRecords(java.util.List<com.amazonaws.services.kinesis.model.Record> batch,
com.amazonaws.services.kinesis.clientlibrary.interfaces.IRecordProcessorCheckpointer checkpointer)
This method is called by the KCL when a batch of records is pulled from the Kinesis stream.
|
static <T> T |
retryRandom(scala.Function0<T> expression,
int numRetriesLeft,
int maxBackOffMillis)
Retry the given amount of times with a random backoff time (millis) less than the
given maxBackOffMillis
|
String |
shardId() |
void |
shutdown(com.amazonaws.services.kinesis.clientlibrary.interfaces.IRecordProcessorCheckpointer checkpointer,
com.amazonaws.services.kinesis.clientlibrary.types.ShutdownReason reason)
Kinesis Client Library is shutting down this Worker for 1 of 2 reasons:
1) the stream is resharding by splitting or merging adjacent shards
(ShutdownReason.TERMINATE)
2) the failed or latent Worker has stopped sending heartbeats for whatever reason
(ShutdownReason.ZOMBIE)
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initializeIfNecessary, initializeLogging, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning
public KinesisRecordProcessor(KinesisReceiver receiver, String workerId, KinesisCheckpointState checkpointState)
public static <T> T retryRandom(scala.Function0<T> expression, int numRetriesLeft, int maxBackOffMillis)
expression
- expression to evalutenumRetriesLeft
- number of retries leftmaxBackOffMillis:
- max millis between retries
Unretryable
- exception, unexpected exception,
or any exception that persists after numRetriesLeft reaches 0public String shardId()
public void initialize(String shardId)
initialize
in interface com.amazonaws.services.kinesis.clientlibrary.interfaces.IRecordProcessor
shardId
- assigned by the KCL to this particular RecordProcessor.public void processRecords(java.util.List<com.amazonaws.services.kinesis.model.Record> batch, com.amazonaws.services.kinesis.clientlibrary.interfaces.IRecordProcessorCheckpointer checkpointer)
processRecords
in interface com.amazonaws.services.kinesis.clientlibrary.interfaces.IRecordProcessor
batch
- list of records from the Kinesis stream shardcheckpointer
- used to update Kinesis when this batch has been processed/stored
in the DStreampublic void shutdown(com.amazonaws.services.kinesis.clientlibrary.interfaces.IRecordProcessorCheckpointer checkpointer, com.amazonaws.services.kinesis.clientlibrary.types.ShutdownReason reason)
shutdown
in interface com.amazonaws.services.kinesis.clientlibrary.interfaces.IRecordProcessor
checkpointer
- used to perform a Kinesis checkpoint for ShutdownReason.TERMINATEreason
- for shutdown (ShutdownReason.TERMINATE or ShutdownReason.ZOMBIE)