简体   繁体   English

无论如何对kafka流应用程序中的不同输入主题使用不同的auto.offset.reset策略?

[英]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.

相关问题 如何使用rest api设置kafka connect auto.offset.reset - how to set kafka connect auto.offset.reset with rest api Kafka 流应用程序重置 globalTable 和输入主题 - Kafka streams application reset globalTable and input topics 不清楚Kafka中auto.offset.reset和enable.auto.commit的含义 - Not clear about the meaning of auto.offset.reset and enable.auto.commit in Kafka 卡卡auto.offset.reset查询 - Kaka auto.offset.reset query 使用多个输入主题时,输入主题的不同消息率会影响kafka流处理速度吗? - When using multiple input topics, does different message rate on input topics affect kafka streams processing speed? spark-streaming-kafka-0-10 auto.offset.reset 始终设置为 none - spark-streaming-kafka-0-10 auto.offset.reset is always set to none Kafka Consumer配置——auto.offset.reset如何控制消息消费 - Kafka Consumer configuration - How does auto.offset.reset controls the message consumption 具有不同主题 ApplicationId 的多个 Kafka 流 - Multiple Kafka Streams with different topics ApplicationId KAFKA客户端库(confluent-kafka-go):auto.offset.reset = latest情况下consumer和producer的同步 - KAFKA client library (confluent-kafka-go): synchronisation between consumer and producer in the case of auto.offset.reset = latest Kafka Streams - 根据 Streams 数据发送不同的主题 - Kafka Streams - Send on different topics depending on Streams Data
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM