You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Ivan Vasyliev (JIRA)" <ji...@apache.org> on 2014/12/29 18:23:13 UTC

[jira] [Created] (CAMEL-8190) Kafka producer: partition key is optional, not required by kafka client api

Ivan Vasyliev created CAMEL-8190:
------------------------------------

             Summary: 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
             Fix For: 2.15.0


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)