title: Expiring 1 record(s) for xxxxx: 30030 ms has passed since batch creation plus linger time
body: <p><strong>My use case:</strong>
  Using Postman, I call a Spring boot soap endpoint. The endpoint creates a KafkaProducer and send a message to a specific topic. I also have a TaskScheduler to consume the topic.</p>
  
  <p><strong>The problem:</strong>
  When calling soap to push a message to a topic, I get this error:</p>
  
  <blockquote>
    <p>2017-11-14 21:29:31.463 ERROR 6389 --- [ad | producer-3]
    DomainEntityProducer                     : Expiring 1 record(s) for
    DomainEntityCommandStream-0: 30030 ms has passed since batch creation
    plus linger time 2017-11-14 21:29:31.464 ERROR 6389 ---
    [nio-8080-exec-6] DomainEntityProducer                     :
    org.apache.kafka.common.errors.TimeoutException: Expiring 1 record(s)
    for DomainEntityCommandStream-0: 30030 ms has passed since batch
    creation plus linger time</p>
  </blockquote>
  
  <p>Here’s the method I use to push to the topic:</p>
  
  <pre><code>public DomainEntity push(DomainEntity pDomainEntity) throws Exception {
      logger.log(Level.INFO, "streaming...");
      wKafkaProperties.put("bootstrap.servers", "localhost:9092");
      wKafkaProperties.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
      wKafkaProperties.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
      KafkaProducer wKafkaProducer = new KafkaProducer(wKafkaProperties);
      ProducerRecord wProducerRecord = new ProducerRecord("DomainEntityCommandStream", getJSON(pDomainEntity));
      wKafkaProducer.send(wProducerRecord, (RecordMetadata r, Exception e) -&gt; {
          if (e != null) {
              logger.log(Level.SEVERE, e.getMessage());
          }
      }).get();
      return pDomainEntity;
  }
  </code></pre>
  
  <p>Using command shell scripts </p>
  
  <blockquote>
    <p>./kafka-console-producer.sh --broker-list 10.0.1.15:9092 --topic
    DomainEntityCommandStream</p>
  </blockquote>
  
  <p>and </p>
  
  <blockquote>
    <p>./kafka-console-consumer.sh --boostrap-server 10.0.1.15:9092 --topic
    DomainEntityCommandStream --from-beginning</p>
  </blockquote>
  
  <p>works very well.</p>
  
  <p>Going through some related problems on Stackoverflow, I have tried to purge the topic:</p>
  
  <blockquote>
    <p>./kafka-topics.sh --zookeeper 10.0.1.15:9092 --alter --topic
    DomainEntityCommandStream --config retention.ms=1000</p>
  </blockquote>
  
  <p>Looking at kafka logs, I see that retention time was altered.</p>
  
  <p>But, no luck, I get the same error.</p>
  
  <p>The payload is ridiculously small, so why should I change batch.size?</p>
  
  <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                    xmlns:gs="http://soap.problem.com"&gt;
     &lt;soapenv:Header/&gt;
     &lt;soapenv:Body&gt;
        &lt;gs:streamDomainEntityRequest&gt;
           &lt;gs:domainEntity&gt;
                  &lt;gs:name&gt;12345&lt;/gs:name&gt;
                  &lt;gs:value&gt;Quebec&lt;/gs:value&gt;
                  &lt;gs:version&gt;666&lt;/gs:version&gt;
              &lt;/gs:domainEntity&gt;
        &lt;/gs:streamDomainEntityRequest&gt;
     &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>