I have a standard spring kafka setup as follows,
@Bean
public ConcurrentKafkaListenerContainerFactory<String, String> feedbackStreamListenerContainerFactory() {
ConcurrentKafkaListenerContainerFactory<String, String> factory = new ConcurrentKafkaListenerContainerFactory<>();
factory.setConsumerFactory(consumerFactory());
return factory;
}
@KafkaListener(topics = ("my-topic"),groupId = ("groupId"),containerFactory = "listenerContainerFactory")
public void myListener(@Payload String message) {
System.out.println("Received Message : " + message);
// do some heavy processing
}
Now I need to have custom logging (generate logs from my app) on 3 scenarios,
- When I boot the consumer lets say the kafka cluster is down or I provided the wrong bootstrap server, I need to custom log it.
- When the consumer starts successfully, just before polling provide a custom log.
- When there is a custom message converter, and if there is a deserialisation issue, custom log it.
question from:
https://stackoverflow.com/questions/65916521/need-spring-kafka-custom-logging 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…