Avoid kafka-clients dependency when using OutgoingKafkaRecordMetadata

3 views
Skip to first unread message

Skander Soltane

unread,
Mar 26, 2026, 1:17:31 PM (2 days ago) Mar 26
to SmallRye

Hi everyone,

I'm using SmallRye Reactive Messaging with the Kafka connector and I'm trying to keep my build-time dependencies as minimal and implementation-agnostic as possible.

In my use case, I need to attach headers using OutgoingKafkaRecordMetadata (and similarly read them with IncomingKafkaRecordMetadata). However, to create headers I currently need to instantiate RecordHeader, which comes from the kafka-clients artifact:

org.apache.kafka.common.header.internals.RecordHeader

This forces me to depend on the full kafka-clients.jar at build time, even though I would prefer to:

  • build only against SmallRye / MP Reactive Messaging APIs
  • rely on the Kafka client implementation only during runtime

So my question is:

Is there a clean or recommended way to use OutgoingKafkaRecordMetadata / IncomingKafkaRecordMetadata (especially for headers) without depending directly on the full kafka-clients artifact, just for RecordHeader?

Thanks in advance for any guidance! 

Skander


Reply all
Reply to author
Forward
0 new messages