8

I'm new in java, spring and kafka
I have the next code for sending message

kafkaTemplate.send(topic, message);

My configuration for producer:

 props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,
            bootstrapServers);
    props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
            IntegerSerializer.class);
    props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
            StringSerializer.class);
    // value to block, after which it will throw a TimeoutException
    props.put(ProducerConfig.MAX_BLOCK_MS_CONFIG, 5000);

I want to send message with my consumer group (example "MyConsumerGroup"),
but I don't know how I can to do it thanks for help

ahmetcetin
  • 2,621
  • 1
  • 22
  • 38
pasha
  • 566
  • 5
  • 19

1 Answers1

1

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.

Graham
  • 7,431
  • 18
  • 59
  • 84
Matthias J. Sax
  • 59,682
  • 7
  • 117
  • 137