pasha pasha - 24 days ago 12
Java Question

How add consumer group to message in java?

I'm new in java, spring and kafka

I have next code for send message

kafkaTemplate.send(topic, message);

My configuration for producer:

// value to block, after which it will throw a TimeoutException
props.put(ProducerConfig.MAX_BLOCK_MS_CONFIG, 5000);

I want send message with my consumer group (example "MyConsumerGroup"),

but I don't see how I can to do it
thanks for help

Answer Source

The concept of "consumer groups" only applies to consumers (as the name suggest). If you write a message to Kafka, any consumer group can read the message later on.

Thus, if you write a message, specifying a consumer group is not possible because it would not make any sense.