Kafka ByteArray
<p>I'm using Kafka to send produce and consume messages.</p>

<p>Producing is fine, working with a <code>&lt;String, ByteArray&gt;</code> producer.</p>

<p>When consuming, I'm using the code below (taken from an example) but I'm getting each record as being just 8 bytes (sample output beneath code).</p>

<p>Is there a way a consumer can simply take a whole message as a byte array?</p>

<p>Code:</p>

<pre class="lang-java prettyprint-override"><code>props.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
props.put("value.deserializer", "org.apache.kafka.common.serialization.ByteArrayDeserializer");
KafkaConsumer&lt;String, byte[]&gt; consumer = new KafkaConsumer&lt;String, byte[]&gt;(props);

consumer.subscribe(Arrays.asList(topic));
int i = 0;

while (true) {
    ConsumerRecords&lt;String, byte[]&gt; records = consumer.poll(100);
    for (ConsumerRecord&lt;String, byte[]&gt; record : records)
        System.out.printf("offset = %d, key = %s, value = %s\n", record.offset(), record.key(), record.value());
}
</code></pre>

<p>Output of System.out :</p>

<pre><code>offset = 1773133, key = 105906453, value = [B@b8eff39
offset = 1773134, key = 105906453, value = [B@7bb1504
offset = 1773135, key = 105906453, value = [B@67b6c728
offset = 1773136, key = 105906453, value = [B@60b1f9c5
offset = 1773137, key = 105906177, value = [B@1cbab5dd
offset = 1773138, key = 105906177, value = [B@4376907b
offset = 1773139, key = 105906177, value = [B@122880ba
offset = 1773140, key = 105906177, value = [B@7db82ceb
offset = 1773141, key = 105906177, value = [B@34657adc
</code></pre>

<p>I'm not looking forward to having to assemble a load of these records to re-create a message as I believe I'm missing something and manual assembly may be error prone.</p>