[英]Is it possible to edit values after Kafka consumer has been initiated? (from org.apache.kafka.clients.consumer)
I'd like to know if it's possible to edit the values I gave while constructing a Kafka consumer later, namely:我想知道是否可以编辑我稍后在构建 Kafka 消费者时给出的值,即:
public Consumer<String, String> createCons(){
final Properties props = new Properties();
props.put(ConsumerConfig.GROUP_ID_CONFIG, "myId")
props.put...
Consumer cons = new KafkaConsumer(props)
return cons
}
Is it possible to edit the values (specifically groupId) of my consumer cons after it has been generated?生成后是否可以编辑我的消费者 cons 的值(特别是 groupId)? I would like to test for changes in the groupId我想测试 groupId 的变化
Ex:前任:
cons.setGroupId("newId")
I have looked at the docs but no answer there.我查看了文档,但那里没有答案。 I assume it could be something with how Properties class behaves and that it's not actually possible to edit..我认为这可能与 Properties class 的行为方式有关,并且实际上无法编辑..
Thank you!谢谢!
It is not possible to change a Consumer instance's configuration after it's created.消费者实例创建后无法更改其配置。
If you need a different configuration, you need to create a new instance of the client.如果您需要不同的配置,则需要创建客户端的新实例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.