title: Implementing Spring Integration InboundChannelAdapter for Kafka
body: <p>I am trying to implement a custom inbound channel adapter in spring integration to consume messages from <a href="http://kafka.apache.org/" rel="nofollow">apache kafka</a>. Based on spring integration examples, I found that I need to create a class that implements MessageSource interface and implement receive() method that would return consumed Message from kafka. But based on <a href="http://kafka.apache.org/quickstart.html" rel="nofollow">consumer example in kafka</a>, the message iterator in KafkaStream is backed by a BlockingQueue. So if no messages are in the queue, the thread will be blocked. </p>
  
  <p>So what is the best way to implement a receive() method as this method can potentially block until there is something to consume.. ?</p>
  
  <p>In more general sense, How do we implement a custom inbound channel for streaming message sources that blocks until there is something ready to consume..?</p>