I need to start working with kafka. I have a hard time getting my head around on what should the Consumer receive: From what I understand we can configure the consumer in multiple ways:
example 1:
@KafkaListener(topics = "topic_name)
public void receiveSimpleString(@Payload String message) {
}
example 2:
@KafkaListener(topics = "topic_name)
public void receiveConsumerRecord(@Payload ConsumerRecord<String, String> message) {
}
example 3:
@KafkaListener(topics = "topic_name)
public void receiveObject(@Payload SomeCustomClass message) {
}
example 4:
@KafkaListener(topics = "topic_name)
public void receiveSpringMessage(@Payload org.springframework.messaging.Message<T> message) {
}
Maybe there are even more ways, but those once are what i mostly saw while researching for kafka+spring.
The question now is:
Is there a best practice on what the consumer should receive? Are there pros/cons of the different examples?