A Spring boot Application with Leader Election using spring-integration.
- Leader Election using Zookeeper and Spring-integration
- Loads resource(s) that are decorated with build time properties such as
project.version
. - See docs
- Loads resource(s) that are decorated with build time properties such as
- Use @Primary, when there are more than 1 candidate beans found for autowiring
- DropWizard ScheduledReporters have start and stop methods, but are not designed to be started and stopped more thanonce. Hence using a Prototype Scope with these Reporters to get a different instance on Leader election.
- System Metrics and Health using spring-actuator
- Uses an external XML configuration file in addition to application.properties
- Uses apache commons configuration to parse the XML configuration
- Issue: PlaceHolders in Lists are not expanded
- Structured app as shown here
- Spring-Integration documentation on leader election
- Spring-cloud: _<> has been sunset in favor of Spring-Integration.
- Interesting issue
- Source on github
- Roles
If you don't have Zookeeper installed, the easiest way to run Zookeeper is to start TestingServer
.
See com.tutorial.spring.pictogram.PictogramApplicationTests
Use SSH local port forwarding:
ssh -NL 9191:localhost:2181 localhost
Change the following Program Arguments for each instance:
--zookeeper.port=9191 --management.port=9091 --server.port=9090