Features of Consul
-
Distributed configuration
-
Service registration and discovery
-
Distributed events
-
Distributed locking and sessions
-
Supports multiple data centers
-
Built in, user-friendly user interface
See the intro for more information.
-
Spring Cloud
DiscoveryClient
implementation-
supports Spring Cloud Gateway
-
supports Spring Cloud LoadBalancer
-
-
Consul based
PropertySource
loaded during the 'bootstrap' phase. -
Spring Cloud Bus implementation based on Consul events
-
Run
docker-compose up
-
Verify consul is running by visiting http://localhost:8500
-
Run
mvn 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-${VERSION}.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-${VERSION}.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).
Unresolved directive in https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/modules/ROOT/pages/building.adoc - include::partial$building.adoc[]
Unresolved directive in https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/modules/ROOT/pages/contributing.adoc - include::partial$contributing.adoc[]