Hi Team… is there a way I can build a kafka consumer to look for a particular key ?
Hello, how about using ksqlDB to create a materialized table?
If you’re using the Consumer API, there’s no way to just ask for records with a given key. You have to read all the records and just look for the ones with the key you want. If your topic is partitioned (very likely), then keep in mind that a record’s key is used to determine its partition. So you can figure out which partition all the records with your target key are in and only consume the records in that partition to avoid having to read all the other partitions that wouldn’t contain the records you’re trying to find.
Assuming the records were produced using the default partitioner (likely), I think you can use the BuiltinPartitioner.partitionForKey
method to determine the partition for a given key:
What if I have the offset and partition …then Can i just read that one message I am looking for?