-
Notifications
You must be signed in to change notification settings - Fork 41.1k
Externalization of authExceptionRetryInterval for listeners and other improvements #44425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The |
A property for authExceptionRetryInterval has been added recently in #44199.
Can you please provide an example of what you have in mind here? |
We already have |
Nice, thanks!
I’m not sure if my understanding is 100% correct, so I ask you to check whether what I’m suggesting makes sense or not. From my analysis, the handling of fatal authentication errors occurs in the run() method of KafkaMessageListenerContainer<K, V>.ListenerConsumer, as shown in the code below. However, the handling of errors during the processing of a record happens at a different moment, and all handling mechanisms for this type of error only work for non-fatal errors.
It would be possible to implement what I have in mind in different ways, just as it is for other types of errors, but I will try to provide a general idea.
I emphasize that if my understanding is incorrect, please let me know. Thank you in advance. |
I don’t see how I could use this together with a listener created with the @KafkaListener annotation. I would have to reimplement my consumers in a different way! How did you envision its usage? |
The That Either way this looks like totally different story not related to the original request for the property to expose. Please, confirm and we can close this as a duplicated of the mentioned one with a desired fix. |
You can close this. My mistake was assuming that the property was linked to spring-kafka, which caused the topics to get mixed up... my bad. My idea was to implement a more customized authentication retry to prevent the container from stopping and needing a restart. But for now, the retry using AuthExceptionRetryInterval meets my needs. I will take a closer look at this ConsumerRetryAuthEvent issue. Thanks! |
Expected Behavior
I would like to suggest externalizing the authExceptionRetryInterval property used in the org.springframework.kafka.listener.ConsumerProperties class, allowing its configuration through application.properties.
Something like: spring.kafka.listener.auth-exception-retry-interval=5000
It would also be interesting if there were an option to configure a backoff policy or even allow the implementation of a custom handler for fatal exceptions like AuthenticationException.
Current Behavior
Currently, this configuration must be implemented manually in ConcurrentKafkaListenerContainerFactory and only supports a fixed retry interval.
Example:
Context
This way, we would avoid the need to implement code to activate this mechanism, which provides resilience for consumer applications.
The text was updated successfully, but these errors were encountered: