I have a Spring Boot application which acts as a producer and consumer for a Kafka cluster (Spring Kafka v3.0.17, Kafka client v3.4.1). App and cluster run both on Kubernetes. Additionally, the app uses a Kafka admin client for some administrative tasks.
The communication between app and cluster uses mutual TLS. The Kafka cluster rotates cluster and client certificates regularly, and I need to take care that the application continues running with the new certificates. I set up new truststores and keystores with the new credentials and restarting producers (ProducerFactory#reset
) and consumers (KafkaListenerEndpointRegistry#start
/KafkaListenerEndpointRegistry#stop
).
My problem is the Kafka admin client. The API there provides only a close()
, which closes the admin client for good. There seems to be no option to restart. Destroying the bean encompassing the admin client does not seem to do the trick either.
I tried to destroy the Kafka admin client bean, but that had either no effect, or it continued using the original credentials resulting in SSL errors.
Does anyone have an idea how to do this properly? Thanks in advance!
user25605566 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.