multiple consumers per kinesis shard

后端 未结 2 1869
遇见更好的自我
遇见更好的自我 2020-12-28 17:28

I read you can have multiple consumer apps per kinesis stream.

http://docs.aws.amazon.com/kinesis/latest/dev/developing-consumers-with-kcl.html

however, I h

2条回答
  •  隐瞒了意图╮
    2020-12-28 17:56

    Kinesis Client Library starts threads in the background, each listens to 1 shard in the stream. You cannot connect to a shard over multiple threads, that is by-design.

    http://docs.aws.amazon.com/kinesis/latest/dev/kinesis-record-processor-scaling.html

    For example, if your application is running on one EC2 instance, and is processing one Amazon Kinesis stream that has four shards. This one instance has one KCL worker and four record processors (one record processor for every shard). These four record processors run in parallel within the same process.

    In the explanation above, the term "KCL worker" refers to a Kinesis consumer application. Not the threads.

    But below, the same "KCL worker" term refers to a "Worker" thread in the application; which is a runnable.

    Typically, when you use the KCL, you should ensure that the number of instances does not exceed the number of shards (except for failure standby purposes). Each shard is processed by exactly one KCL worker and has exactly one corresponding record processor, so you never need multiple instances to process one shard.

    See the Worker.java class in KCL source.

提交回复
热议问题