Preview of Spring Cloud Consul implementation
consul does
- distributed configuration
- service registration and discovery
- messaging
- distributed locking and sessions
- supports multiple data centers
- has a slick ui
See the intro for more information.
- Install consul
- Run
./run_consul.sh
found in the root of this project - verify consul is running by visiting http://localhost:8500
- run
mvn --settings .settings.xml package
this will bring in the required spring cloud maven repositories and build - run
java -jar spring-cloud-consul-sample/target/spring-cloud-consul-sample-1.0.0.BUILD-SNAPSHOT.jar
- visit http://localhost:8080, verify that
{"serviceId":"<yourhost>:8080","host":"<yourhost>","port":8080}
results - run
java -jar spring-cloud-consul-sample/target/spring-cloud-consul-sample-1.0.0.BUILD-SNAPSHOT.jar --server.port=8081
- visit http://localhost:8080 again, verify that
{"serviceId":"<yourhost>:8081","host":"<yourhost>","port":8081}
eventually shows up in the results in a round robbin fashion (may take a minute or so).