[英]Is there anyway to use different auto.offset.reset strategy for different input topics in kafka streams app?
The use case is: I have a kafka streams app that consumer from an input topic, and output to a intermediate topic, then in the same streams another topology consume from this intermediate topic.用例是:我有一个 kafka 流应用程序,该应用程序从输入主题消费,并输出到中间主题,然后在同一流中另一个拓扑从该中间主题消费。
Whenever the application id is updated, both topic start to consumer from earliest.每当应用程序 id 更新时,两个主题都从最早开始到消费者。 I want to change the auto.offset.reset for the intermediate topic to latest while keep that to earliest for the input topic.
我想将中间主题的 auto.offset.reset 更改为最新,同时将输入主题的 auto.offset.reset 保持为最早。
Yes.是的。 You can set the reset strategy for each topic via:
您可以通过以下方式为每个主题设置重置策略:
// Processor API
topology.addSource(AutoOffsetReset offsetReset, String name, String... topics);
// DSL
builder.stream(String topic, Consumed.with(AutoOffsetReset offsetReset));
builder.table(String topic, Consumed.with(AutoOffsetReset offsetReset));
All those methods have some overloads that allow to set it.所有这些方法都有一些允许设置它的重载。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.