ListenerContainerWithDlqAndRetryCustomizer template points to localhost:9092
See original GitHub issueHi,
I am using following dependencies
spring-cloud-stream: 3.21
spring-cloud-stream-binder-kafka: 3.21
spring-kafka: 2.8.2
To forward deserialization errors to DLQ, I added the following bean:
	@Bean
	ListenerContainerWithDlqAndRetryCustomizer cust(KafkaTemplate<?, ?> template) {
		return new ListenerContainerWithDlqAndRetryCustomizer() {
			@Override
			public void configure(AbstractMessageListenerContainer<?, ?> container, String destinationName,
					String group,
					BiFunction<ConsumerRecord<?, ?>, Exception, org.apache.kafka.common.TopicPartition> dlqDestinationResolver,
					BackOff backOff) {
				ConsumerRecordRecoverer dlpr = new DeadLetterPublishingRecoverer(template, dlqDestinationResolver);
				container.setCommonErrorHandler(new DefaultErrorHandler(dlpr, backOff==null? new FixedBackOff(0L, 1L):backOff));
			}
                        ......
		};
	}
I have the following configuration in application.yml
spring.cloud:
    schemaRegistryClient:
      endpoint: .....
    stream:
      default:
        consumer:
          maxAttempts: 1
      function:
        definition: myDataConsumer
      bindings:        
        myDataConsumer-in-0:
          destination: input-topic
          ....
        myDataConsumer-output:
          destination: output-topic
          ...
      kafka:
        default:
          consumer:
            useNativeDecoding: true
            enableDlq: true
            dlqName: dlq-topic
        bindings:
          myDataConsumer-in-0:
            consumer:
                ...
        binder:
          brokers: "broker1Url,broker2Url"
          producer-properties:
               ...
When the application runs and if there are Deserialization errors, it tries to produce to non-existent  localhost:9092 instead of the brokers in the config.
What am I missing?
Thanks in advance
Issue Analytics
- State:
 - Created a year ago
 - Comments:5 (3 by maintainers)
 
Top Results From Across the Web
ListenerContainerWithDlqAndRe...
ListenerContainerWithDlqAndRetryCustomizer template points to localhost :9092 spring-cloud/spring-cloud-stream-binder-kafka#1208.
Read more >Spring Cloud Stream Kafka Binder Reference Guide
template ) { return new ListenerContainerWithDlqAndRetryCustomizer() { @Override ... expects that you are running the broker at the default localhost:9092 .
Read more >Not able to create custom RetryTemplate using ...
I am using spring cloud stream with multiple binders . I tried to create custom RetryTemplate using @StreamRetryTemplate . Bean of custom ...
Read more >spring-cloud/spring-cloud-stream-binder-kafka - Issues Antenna
ListenerContainerWithDlqAndRetryCustomizer template points to localhost :9092. 000. Hi, I am using following dependencies ...
Read more >spring-cloud-stream-binder-kafka - bytemeta
ListenerContainerWithDlqAndRetryCustomizer template points to localhost :9092. wouterTj. wouterTj CLOSED · Updated 8 months ago ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Little writeup to make it easy for others https://medium.com/@sidsamanta/spring-cloud-stream-kafka-errors-to-dead-letter-queue-dlq-bb4078d9c6a0
You are wiring in Boot’s auto-configured
KafkaTemplate. Boot knows nothing about binders or binder configuration; it uses the normal Bootspring.kafka....properties when configuring that template.https://docs.spring.io/spring-boot/docs/current/reference/html/application-properties.html#application-properties.integration.spring.kafka.bootstrap-servers