title: EmbeddedKafka how to check received messages in unit test
body: <p>I created a spring boot application that sends messages to a Kafka topic. I am using spring <code>spring-integration-kafka</code>:
  A <code>KafkaProducerMessageHandler&lt;String,String&gt;</code> is subscribed to a channel (<code>SubscribableChannel</code>) and pushes all messages received to one topic.
  The application works fine. I see messages arriving in Kafka via console consumer (local kafka).</p>
  
  <p>I also create an Integrationtest that uses <code>KafkaEmbedded</code>. I am checking the expected messages by subscribing to the channel within the test - all is fine.</p>
  
  <p>But i want the test to check also the messages put into kafka. Sadly Kafka's  JavaDoc is not the best. What i tried so far is:</p>
  
  <pre><code>@ClassRule
  public static KafkaEmbedded kafkaEmbedded = new KafkaEmbedded(1, true, "myTopic");
  //...
  @Before
  public void init() throws Exception {
  
      mockConsumer = new MockConsumer&lt;&gt;( OffsetResetStrategy.EARLIEST );
      kafkaEmbedded.consumeFromAnEmbeddedTopic( mockConsumer,"sikom" );
  
  }
  //...
  
  @Test
  public void endToEnd() throws Exception {
  //  ...
  
      ConsumerRecords&lt;String, String&gt; records = mockConsumer.poll( 10000 );
  
      StreamSupport.stream(records.spliterator(), false).forEach( record -&gt; log.debug( "record: " + record.value() ) );
  
  
  }
  </code></pre>
  
  <p>The problem is that i don't see any records. I am not sure if my KafkaEmbedded setup is correct.
  But messages are receive by the channel.</p>