Micronaut kafka producer batch mode how to include the key

Viewed 31

I'm implementing a kafka producer and I want to use the batch mode to improve the performance.

This is my client:

@KafkaClient(id = "producer-1",batch=true)
public interface KafkaProducer {
  void send(@Topic String topic, List<DeliveryMessageKafka> list);
}

The problem is that I want to include the key and I don't know how to do it.

I have tried this version:

@KafkaClient(id = "producer-1",batch=true)
public interface KafkaProducer {
  void send(@Topic String topic, List<ProducerRecord<String, DeliveryMessageKafka>> list);
}

But it doesn't work.

Regards

0 Answers
Related