【发布时间】:2018-12-03 11:52:45
【问题描述】:
我正在使用 confluent Kafka-rest 产品来使用主题中的记录。我的意图是只使用主题的前 100 条记录。我正在使用以下 REST API 来获取记录
GET /consumers/testgroup/instances/my_consumer/records
如何做到这一点?有什么想法吗?
【问题讨论】:
-
您正在使用一个保持消费者偏移量的消费者组,因此当您请求新记录时,您不会获得该主题的第一条记录。您会获得尚未使用的新记录。您真的想要主题的前 100 条记录,还是想要在每个 API 休息调用中消耗 100 条记录?
-
另外,您可以与GET records endpoint 一起使用的唯一大小控制参数似乎是
max_bytes,它不会直接转换为记录数,但应该适合您。 -
不认为这是可能的:
Consumer configuration - Although consumer instances are not shared, they do share the underlying server resources. Therefore, limited configuration options are exposed via the API. However, you can adjust settings globally by passing consumer settings in the REST Proxy configuration.但docs.confluent.io/current/kafka-rest/docs/config.html 没有提及任何相关设置
标签: apache-kafka confluent-platform kafka-rest