I can't find a solution or any hints online regarding my problem.
I want to set up central configuration manager with Apache Zookeeper for my Spring Boot application which can have multiple instances at the same time.
So in Zookeeper, I would only have some kind of data which are ranges:
0-100
101-200
...
900-1000...
Let's say that I have two instances (A and B) of application at the start. Then instance A would get range 0-100 and instance B would get next available range which is 101-200. If a new instance is added or some instance is restarted then it would get next available range. Each instance would only need to read data from configuration once and that is on an instance startup.
I know to read data from Zookeeper with @Value and @ConfigurationProperties.
To be specific with questions:
- How to configure Zookeeper in this way so once data is read it is not valid or relevant anymore?
- How to set up in Spring Boot to read configuration from Zookeeper only once, on application startup?