smallrye-reactive-messaging
smallrye-reactive-messaging copied to clipboard
[Kafka Test Companion] Inconsistent handling of properties
The problem
In Kafka Test Companion's ProducerBuilder
and ConsumerBuilder
, the properties seem to be treated inconsistently:
- The constructors of both
ProducerBuilder
andConsumerBuilder
use the signatureMap<String, Object>
- The
properties
field in bothProducerBuilder
andConsumerBuilder
also use the signatureMap<String, Object>
- The method
ConsumerBuilder#withProps
also use the signatureMap<String, Object>
However:
- The method
ProducerBuilder#withProps
uses the signatureMap<String, String>
- Both
ProducerBuilder#withProp
andConsumerBuilder#withProp
use the typeString
for the value
As both KafkaConsumer
and KafkaProducer
support properties of the form Map<String, Object>
, it seems like ProducerBuilder
and ConsumerBuilder
should use this form instead of restricting the property value to String
.
Suggestion of implementation
- Change
ProducerBuilder#withProps
to take aMap<String, Object>
- Change both
ProducerBuilder#withProp
andConsumerBuilder#withProp
to use the typeObject
for the value
I am willing to work on the PR, I just need confirmation that this change would be welcome.