我可以根据Kafka的特定条件消费吗? [英] Can i consume based on specific condition in Kafka?

查看:30
本文介绍了我可以根据Kafka的特定条件消费吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在向 Kafka 写入一个 msg 并在另一端使用它.在其中做一些处理并将其写回另一个 Kafka 主题.

I'm writing a msg in to Kafka and consuming it in the other end. Doing some process in it and writing it back to another Kafka topic.

我想知道哪个消息响应针对哪个请求..

I want to know which message response is for which request..

当前决定从消费者端捕获偏移 id,然后写入响应并读取响应负载并决定相同.

currently decided to capture the offset id from consumer side then write in the response and read the response payload and decide the same.

对于这种方法,我们需要读取每条消息,还有其他方法可以根据消费者配置条件消费吗?

For this approach we need to read each message is there any other way we can consume based on consumer config condition?

推荐答案

消费者只能阅读整个主题.您只能通过 seek() 跳过消息,但没有可以在代理上评估以过滤消息的条件.

Consumers can only read the whole topic. You can only skip messages via seek() but there is no conditions that you can evaluate on the broker to filter messages.

您将需要在客户端使用整个主题一个进程/过滤器.

You will need to consume the whole topic an process/filter in the client.

这篇关于我可以根据Kafka的特定条件消费吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆