[
https://issues.apache.org/jira/browse/CAMEL-8190?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen resolved CAMEL-8190.
--------------------------------
Resolution: Fixed
Fix Version/s: 2.14.2
Assignee: Claus Ibsen
Thanks for reporting and the patch.
> Kafka producer: partition key is optional, not required by kafka client api
> ---------------------------------------------------------------------------
>
> Key: CAMEL-8190
> URL: https://issues.apache.org/jira/browse/CAMEL-8190
> Project: Camel
> Issue Type: Bug
> Components: camel-kafka
> Affects Versions: 2.14.1
> Reporter: Ivan Vasyliev
> Assignee: Claus Ibsen
> Fix For: 2.14.2, 2.15.0
>
> Attachments: kafka_producer__partition_key_is_optional.patch
>
>
> In order to send to kafka, one need to construct KeyedMessage.
> {code}
> public KeyedMessage(String topic, K key, Object partKey, V message) {
> this.topic = topic;
> this.key = key;
> this.partKey = partKey;
> this.message = message;
> class.$init$(this);
> if(topic == null) {
> throw new IllegalArgumentException("Topic cannot be null.");
> }
> }
> public KeyedMessage(String topic, V message) {
> Object var10002 = null;
> Object var10003 = null;
> this(topic, (Object)null, (Object)null, message);
> }
> public KeyedMessage(String topic, K key, V message) {
> {code}
> Looks like only topic is required parameter, but partition key is optional.
> Also, if key is provided by the user I think is makes sense to propagate it.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)