Kafka Consumer subscription vs. assigned partition
<p>Kafka is confusing me. I am running it local with standard values.
only auto create topic turned on. 1 partition, 1 node, everything local and simple.
If it write</p>

<pre><code>consumer.subscribe("test_topic");
consumer.poll(10);
</code></pre>

<p>It simply won't work and never finds any data.
If I instead assign a partition like</p>

<pre><code>consumer.assign(new TopicPartition("test_topic",0));
</code></pre>

<p>and check the position I sit at 995. and now can poll and receive all the data my producer put in.</p>

<p>What is it that I don't understand about subscriptions? I don't need multiple consumers each handling only a part of the data. My consumer needs to get all the data of a certain topic. Why does the standard subscription approach not work for me that is shown in all the tutorials?
I do understand that partitions are for load balancing consumers. I don't understand what I do wrong with the subscription.</p>

<pre><code>consumer config properties
    props.put("bootstrap.servers", "localhost:9092");
    props.put("group.id", "postproc-" + EnvUtils.getAppInst()); // jeder ist eine eigene gruppe -&gt; kriegt alles
    props.put("enable.auto.commit", "true");
    props.put("auto.commit.interval.ms", "1000");
    props.put("session.timeout.ms", "30000");
    props.put("key.deserializer", "org.apache.kafka.common.serialization.LongDeserializer");
    props.put("value.deserializer", "org.apache.kafka.common.serialization.ByteArrayDeserializer");
    KafkaConsumer&lt;Long, byte[]&gt; consumer = new KafkaConsumer&lt;Long, byte[]&gt;(props);

producer config
 props.put("bootstrap.servers", "localhost:9092");
        props.put("acks", "all");
        props.put("retries", 2);
        props.put("batch.size", 16384);
        props.put("linger.ms", 5000);
        props.put("buffer.memory", 1024 * 1024 * 10); // 10mb
        props.put("key.serializer", "org.apache.kafka.common.serialization.LongSerializer");
        props.put("value.serializer", "org.apache.kafka.common.serialization.ByteArraySerializer");
        return new KafkaProducer(props);

producer execution
try (ByteArrayOutputStream out = new ByteArrayOutputStream()){
            event.writeDelimitedTo(out);
            for (long a = 10; a&lt;20;a++){
                long rand=new Random(a).nextLong();
                producer.send(new ProducerRecord&lt;&gt;("test_topic",rand ,out.toByteArray()));
            }
            producer.flush();
        }catch (IOException e){
</code></pre>

<p>consumer execution</p>

<pre><code>consumer.subscribe(Arrays.asList("test_topic"));
ConsumerRecords&lt;Long,byte[]&gt; records = consumer.poll(10);
for (ConsumerRecord&lt;Long,byte[]&gt; r :records){ ...
</code></pre>