Class FanOutShardSubscriber
- java.lang.Object
-
- org.apache.flink.streaming.connectors.kinesis.internals.publisher.fanout.FanOutShardSubscriber
-
@Internal public class FanOutShardSubscriber extends Object
This class is responsible for acquiring an Enhanced Fan Out subscription and consuming records from a shard. A queue is used to buffer records between the Kinesis Proxy and Flink application. This allows processing to be separated from consumption; errors thrown in the consumption layer do not propagate up to application.[ | ----------- Source Connector Thread ----------- | | --- KinesisAsyncClient Thread(s) -- | | FanOutRecordPublisher | FanOutShardSubscription | == blocking queue == | KinesisProxyV2 | KinesisAsyncClient | ]Three types of message are passed over the queue for inter-thread communication:
FanOutShardSubscriber.SubscriptionNextEvent- passes data from the network to the consumerFanOutShardSubscriber.SubscriptionCompleteEvent- indicates a subscription has expiredFanOutShardSubscriber.SubscriptionErrorEvent- passes an exception from the network to the consumer
The blocking queue has a maximum capacity of two. One slot is used for a record batch, the remaining slot is reserved to completion events. At maximum capacity we will have two
SubscribeToShardEventin memory (per instance of this class):- 1 event being processed by the consumer
- 1 event enqueued in the blocking queue