What are KafkaListener Annotation Properties?

Your thoughts?

|
  • id
  • containerFactory
  • topics
  • topicPattern
  • topicPartitions
  • containerGroup
  • errorHandler
  • groupId
  • idIsGroup
  • clinetIdPrefix
  • beanRef
  • concurrency
  • autoStartup
  • properties
  • splitIterables
  • contentTypeConverter
  • batch


I think most of these are optional...I have only had issues when I don't include id and topics...makes sense.

|

@KafkaListener annotation allows you to configure underlying consumer like so...

@Component
public class Listener {
    @KafkaListener(properties = {"bootstrap.servers=localhost:9092"}, id = "foo", topics = "myTopic")
    public void listen(String data) {
        System.out.println(data);
    }
}

Notice how you can set things like topics and consumerGroupId as well as underlying consumer properties via the properties = {}...


|

properties that allow you to configure the consumer that you are really setting up under the hood when you use such annotations :)