title: Kafka 2.9.2-0.8.1.1 no KeyedMessage parameter for producer.send
body: <p>I am trying to send a message to Kafka in java. My project is using kafka_2.9.2-0.8.1.1.jar via the maven dependency:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;dependency&gt;
    &lt;groupId&gt;org.apache.kafka&lt;/groupId&gt;
    &lt;artifactId&gt;kafka_2.9.2&lt;/artifactId&gt;
    &lt;version&gt;0.8.1.1&lt;/version&gt;
    &lt;exclusions&gt;
      &lt;exclusion&gt;
        &lt;groupId&gt;org.apache.zookeeper&lt;/groupId&gt;
        &lt;artifactId&gt;zookeeper&lt;/artifactId&gt;
      &lt;/exclusion&gt;
      &lt;exclusion&gt;
        &lt;groupId&gt;log4j&lt;/groupId&gt;
        &lt;artifactId&gt;log4j&lt;/artifactId&gt;
      &lt;/exclusion&gt;
    &lt;/exclusions&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>The problem I am having is with my producer. I want to send a KeyedMessage and via the documentation here: <a href="http://kafka.apache.org/documentation.html#producerapi" rel="nofollow">http://kafka.apache.org/documentation.html#producerapi</a> it states that the producer.send method should take a KeyedMessage for its parameter. When I inspect the options avaiable for the producer.send call, it only allows a ProducerData object as an acceptable paramater. </p>
  
  <p>My code is set up like so:</p>
  
  <pre class="lang-java prettyprint-override"><code>    private String topic;   
      private String key;
      private Properties props = new Properties();
      private Producer&lt;String,String&gt; producer;
  
      props.put("serializer.class", "kafka.serializer.StringEncoder");
      props.put("zk.connect", "127.0.0.1:2181");  
  
      //create the producer
      producer = new Producer&lt;String, String&gt;(new ProducerConfig(props));   
  
      String topic = "test";
      String key = "test_key";
      String message = "test_msg";
  
      KeyedMessage&lt;String, String&gt; data = new KeyedMessage&lt;String, String&gt;(topic, key, message);
      producer.send(data)  &lt;---- ERROR is here, send method not allowed param of KeyedMessage
  </code></pre>
  
  <p>The actual error is this states as this:</p>
  
  <pre><code> The method send(ProducerData&lt;String,String&gt;) in the type Producer&lt;String,String&gt; is not applicable for the arguments (KeyedMessage&lt;String,String&gt;)
  </code></pre>