title: Topic partition appears as null when application is run on local Kafka instance
body: <p>I have this producer:</p>
  <pre><code>public class ProducerDemo {
  
      public static void main(String[] args) {
          
          String inputFile = &quot;C:\\Users\\path\\to\\binary\\file&quot;;
          String bootstrapServers = &quot;127.0.0.1:9092&quot;;
          
          try (
                  InputStream inputStream = new FileInputStream(inputFile);
                  OutputStream outputStream = new FileOutputStream(outputFile);
              ) {
       
                  long fileSize = new File(inputFile).length();
       
                  byte[] allBytes = new byte[(int) fileSize];
       
                  inputStream.read(allBytes);
          
          // create producer properties
          Properties properties = new Properties();
          
          properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
          properties.setProperty(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
          properties.setProperty(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, ByteArraySerializer.class.getName());
          properties.setProperty(ProducerConfig.INTERCEPTOR_CLASSES_CONFIG, &quot;com.cme.pe.kms.EncryptionInterceptor&quot;);
          
          // create the producer
          KafkaProducer&lt;String, byte[]&gt; producer = new KafkaProducer&lt;String, byte[]&gt;(properties);
          
          // create a producer record
          ProducerRecord&lt;String, byte[]&gt; record = new ProducerRecord&lt;String, byte[]&gt;(&quot;foo&quot;, allBytes);
      
          // send asynchronously
          producer.send(record);
          
          // flush and close the producer
          //producer.flush();
          producer.close();
          
          } catch (IOException ex) {
              ex.printStackTrace();
          }
  
      }
  </code></pre>
  <p>I also have a <code>Kafka Intereptor</code> with this method:</p>
  <pre><code>public ProducerRecord&lt;String, byte[]&gt; onSend(final ProducerRecord&lt;String, byte[]&gt; record) {
      try {
          MasterKeyProvider&lt;?&gt; key_provider = keySet.keyProvider(record.topic());
          Toppar toppar = new Toppar(record.topic(), record.partition(), 0L, 0);
          inboundDecoders.get(record.topic()+record.partition()).decodeMsg(record.value(), toppar);
          byte[] buf = encrypt(key_provider, record.value());
  
          return new ProducerRecord&lt;&gt;(record.topic(), record.partition(), record.key(), buf);
      } catch (Exception e) {
          LOGGER.error(&quot;unable to encrypt message&quot;, e);
          return new ProducerRecord&lt;&gt;(record.topic(), record.partition(), record.key(), new byte[0]);
      }
  }
  </code></pre>
  <p>When I run my application I get this error:</p>
  <blockquote>
  <p>java.lang.NullPointerException
  at com.my.app.MyInterceptor.onSend(MyInterceptor.java:44)
  ....
  at com.my.app.ProducerDemo.main(ProducerDemo.java:50)</p>
  </blockquote>
  <p>Line 44 is <code>Toppar toppar = new Toppar(record.topic(), record.partition(), 0L, 0);</code>. I think the issue is that <code>record.partition()</code> is null. I'm running Kafka as a single instance locally. I thought the partition would be 0. Am I seeing correct functionality or how do I resolve this?</p>