I am using spring-cloud-stream-binder-kafka and have implemented stateful retry using DefaultErrorHandler, I want to register different DefaultErrorHandler for different consumer consuming messages from different Kafka topics, and each DefaultErrorHandler will be pushing messages to dlq on recovery based on spring.cloud.stream.kafka.bindings.channel-in-0.consumer.dlqName configuration.

Now when I register a DefaultErrorHandler using ListenerContainerCustomizer I want to access KafkaConsumerProperties for the current input-channel and retrieve dlq name from it and use it in DefaultErrorHandler, so if I can get input-channel name I can get the consumer properties like

@Bean public ListenerContainerCustomizer<AbstractMessageListenerContainer> containerCustomizer() { return (container, dest, group) -> { KafkaConsumerProperties kafkaConsumerProperties = kafkaExtendedBindingProperties.getExtendedConsumerProperties("channel"); String dlqName = kafkaConsumerProperties.getDlqName(); DeadLetterPublishingRecoverer recoverer = new DeadLetterPublishingRecoverer(template, (rec, ex) -> new TopicPartition(dlqName, -1)); container.setCommonErrorHandler(new DefaultErrorHandler(recoverer,new FixedBackOff(2000L, 5L))); }; } 

Related questions 195 Why can I not create a wheel in python? 4 Kivy Color Wheel 0 kivy buildozer permission denied Related questions 195 Why can I not create a wheel in python? 4 Kivy Color Wheel 0 kivy buildozer permission denied 3 Issue with Kivy and Buildozer 1 Error installing kivy 2 Failed building wheel for 96 Could not build wheels since package wheel is not installed 4 ERROR: Could not build wheels for Kivy which use PEP 517 and cannot be installed directly 2 Kivy Issues with .py and .kv 1 How can I fix "Could not build wheels for scikit-image" error? Load 7 more related questions Show fewer related questions

Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.