Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-8190

Kafka producer: partition key is optional, not required by kafka client api

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.14.1
    • 2.14.2, 2.15.0
    • camel-kafka
    • None
    • Patch Available
    • Unknown

    Description

      In order to send to kafka, one need to construct KeyedMessage.

       
          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) {
      

      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.

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            vasilievip Ivan Vasyliev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: