Hello Kafka friends,

We are writing test code that sometimes will talk to a MockProducer
and sometimes to a normal KafkaProducer. Therefore the test harness
will sometimes read the MockProducer-produced records (ProducerRecord)
directly, and sometimes will read actual ConsumerRecords through a
real Consumer from the in-process test broker.

We would like to be able to assert over a record, whether producer or
consumer, but the classes do not have any common interface. Most of
the properties are shared: topic, partition, headers, key, value, and
timestamp.

A straightforward improvement would be to have both ConsumerRecord and
ProducerRecord implement a common interface, KafkaRecord<K,V>, with
accessors for these properties.

I'm happy to contribute the code which should be straightforward but
wanted to validate this idea and make sure it is a contribution that
would be accepted before spending the time to do this. In particular
it might require a KIP even though it's a trivial feature since the
public API is affected.

Does this sound like a good idea to implement? What would the next steps be?

Thanks!
Steven

Reply via email to