Note to duplicate markers: I DID check out the other question, but it does not answer my specific question below.
So imagine I have a Kafka topic on a single server with only one partition. So it is much similar to a queue.
Now lets assume I want 100 listeners waiting to accept values from the queue. So by design, if all 100 consumers are in a single group, the contents from the log (or queue here) will be distributed among the consumers. So the operation will be over in 1/100th of the time.
The problem is that the Spring Kafka listener is only configured with the topic name.
@Service
public class Consumer {
@KafkaListener(topics = "${app.topic}")
public void receive(@Payload String message,
@Headers MessageHeaders headers) {
System.out.println("Received message="+message);
headers.keySet().forEach(key -> System.out.println(key+"->"+headers.get(key)));
}
}
I can seem to get Kafka to spawn up a 100 consumers for processing messages from the "queue" (logs). How can it be done?