Description
When using the ConsumerRecordFactory, it's convenient to specify a default topic to create records with:
ConsumerRecordFactory<String, User> inputFactory = new ConsumerRecordFactory<>(inputTopic, keySerializer, valueSerializer);
However, when the factory is used to create a record with a String key:
inputFactory.create("any string", user)
Compilation fails with the following warning:
Ambiguous method call. Both: create(String, User) in ConsumerRecordFactory and create(String, User) in ConsumerRecordFactory match
At first glance, this is a really confusing error to see during compilation. What's happening is that there are two clashing signatures for `create`: create(K, V) and create(String, V). The latter signature represents a topic name.
It seems like fixing this would require breaking the existing interface. This is a really opaque problem to hit though, and it would be great if we could avoid having users encounter this.
Attachments
Issue Links
- Is contained by
-
KAFKA-8233 KIP-470: TopologyTestDriver test input and output usability improvements
- Resolved