Created
March 31, 2022 03:39
-
-
Save sidsamant/6279d1747f463d082272c8b432544271 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Bean | |
ListenerContainerWithDlqAndRetryCustomizer cust(KafkaTemplate<?, ?> template) { | |
return new ListenerContainerWithDlqAndRetryCustomizer() { | |
@Override | |
public void configure(AbstractMessageListenerContainer<?, ?> container, String destinationName, | |
String group, | |
@Nullable BiFunction<ConsumerRecord<?, ?>, Exception, TopicPartition> dlqDestinationResolver, | |
@Nullable BackOff backOff) { | |
if (destinationName.equals("topicWithLongTotalRetryConfig")) { | |
ConsumerRecordRecoverer dlpr = new DeadLetterPublishingRecoverer(template), | |
dlqDestinationResolver); | |
container.setCommonErrorHandler(new DefaultErrorHandler(dlpr, backOff)); | |
} | |
} | |
@Override | |
public boolean retryAndDlqInBinding(String destinationName, String group) { | |
return !destinationName.contains("topicWithLongTotalRetryConfig"); | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://medium.com/p/bb4078d9c6a0/edit