0

I have a Kafka consumer written using Spring Cloud Stream which connects to Kafka deployed on Amazon MSK cluster with secret manager for periodic password rotation.

Problem:

Do I need to re-instantiate the application on every password rotation? If yes, is there a standard way to do it using Spring Cloud Stream?

Current solution: We have implemented a health check based on the Spring actuator. In case of binder connection failure we restart the ECS.

The current solution is very un-stable as we are still getting SASLAuthentication exception which is not captured by the health check and there is no re-instantiation of the application

Please, suggest me a way out.

Paweł Szymczyk
  • 1,638
  • 15
  • 20

1 Answers1

0

You can reconfigure the consumer and producer factory (with the new credentials).

On the producer side, call reset() on the factory to close the existing producer(s) and reconnect on demand.

On the consumer side, you can stop() and start() the KafkaListenerEndpointRegistry to close and reconnect the consumers.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179