Class ShardConsumer<T>

  • All Implemented Interfaces:
    Runnable

    @Internal
    public class ShardConsumer<T>
    extends Object
    implements Runnable
    Thread that subscribes to the given RecordPublisher. Each thread is in charge of one Kinesis shard only.

    A ShardConsumer is responsible for:

    • Running the RecordPublisher to consume all records from the subscribed shard
    • Deserializing and deaggregating incoming records from Kinesis
    • Logging metrics
    • Passing the records up to the KinesisDataFetcher
    • Constructor Detail

      • ShardConsumer

        public ShardConsumer​(KinesisDataFetcher<T> fetcherRef,
                             RecordPublisher recordPublisher,
                             Integer subscribedShardStateIndex,
                             StreamShardHandle subscribedShard,
                             SequenceNumber lastSequenceNum,
                             ShardConsumerMetricsReporter shardConsumerMetricsReporter,
                             KinesisDeserializationSchema<T> shardDeserializer)
        Creates a shard consumer.
        Parameters:
        fetcherRef - reference to the owning fetcher
        recordPublisher - the record publisher used to read records from kinesis
        subscribedShardStateIndex - the state index of the shard this consumer is subscribed to
        subscribedShard - the shard this consumer is subscribed to
        lastSequenceNum - the sequence number in the shard to start consuming
        shardConsumerMetricsReporter - the reporter to report metrics to
        shardDeserializer - used to deserialize incoming records
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface Runnable