I have a bean running in spring with a method called sendToKafka, in this method, a native kafka producer will be called to send messages to kafka, the client authentication is via SASL/SCRAM, i.e username & password
The question is, we have a refresh mechanism on the password used here, when the password is updated, AuthenticationException will only be seen in the log instead of being returned by the producer API, so I haven't been able to catch the exception. Another issue here is, I cannot seem to restart the producer as a bean in spring. I've tried to pull the bean out of spring with bean registry, destroy the singleton, update the password configuration and register back into spring, this approach doesn't seem to work.
Could anyone provide some insight on a solution to such a scenario? Thanks