Print Kafka Stream Input out to console?
<p>I've been looking through a lot of the Kafka documentation for a java application that I am working on. I've tried getting into the lambda syntax introduced in Java 8, but I am a little sketchy on that ground and don't feel too confident that it should be what I use as of yet.</p>

<p>I've a Kafka/Zookeeper Service running without any troubles, and what I want to do is write a small example program that based on the input will write it out, but not do a wordcount as there are so many examples of already.</p>

<p>As for sample data I will be getting a string of following structure:</p>

<h1>Example data</h1>

<pre><code>This a sample string containing some keywords such as GPS, GEO and maybe a little bit of ACC.
</code></pre>

<h1>Question</h1>

<p>I want to be able to extract the 3 letter keywords and print them with a <code>System.out.println</code>. How do I get a string variable containing the input? I know how to apply regular expressions or even just searching through the string to get the keywords.</p>

<h1>Code</h1>

<pre><code>public static void main(String[] args) {
    Properties props = new Properties();
    props.put(StreamsConfig.APPLICATION_ID_CONFIG, "app_id");
    props.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "0:0:0:0:0:0:0:1:9092");
    props.put(StreamsConfig.ZOOKEEPER_CONNECT_CONFIG, "0:0:0:0:0:0:0:1:2181");
    props.put(StreamsConfig.KEY_SERDE_CLASS_CONFIG, Serdes.String().getClass().getName());
    props.put(StreamsConfig.VALUE_SERDE_CLASS_CONFIG, Serdes.String().getClass().getName());

    final Serde&lt;String&gt; stringSerde = Serdes.String();

    KStreamBuilder builder = new KStreamBuilder();

    KStream&lt;String, String&gt; source = builder.stream(stringSerde, stringSerde, "in-stream");

    KafkaStreams streams = new KafkaStreams(builder, props);
    streams.start();

    //How do I assign the input from in-stream to the following variable?
    String variable = ?
}
</code></pre>

<p>I have zookeeper, kafka, producer and consumer running all hooked up to the same topic so I want to basically see the same <code>String</code> appear on all of the instances (producer, consumer and stream).</p>