The eureka example requires 3 participants:
- a centralized eureka server for registration and discovery
- an example service to register with eureka that exposes a REST endpoint
- an example client that discovers the example service via discovery, and then queries the example service on it's registered REST endpoint.
- Build the application.
- The above build also sets up all the libraries needed for running the demo service and the demo client.
- Copy the WAR artifact to your tomcat deployment directory under _$TOMCAT_HOME/webapps/
cp ./eureka-server/build/libs/eureka-server-XXX-SNAPSHOT.war $TOMCAT_HOME/webapps/eureka.war
- Start your tomcat server. Access http://localhost:8080/eureka to verify the information there. Your server's eureka client should register itself in 30 seconds and you should see that information there.
- Start up a local eureka server
- Run the example service first with
./gradlew :eureka-examples:runExampleService
and wait until you see "Service started and ready to process requests.." indicating that is had registered with eureka. - Run the example client with
./gradlew :eureka-examples:runExampleClient
.
- Start up a local eureka server
- Build a zip distribution with
./gradlew :eureka-examples:distZip
- In the distribution run
./bin/ExampleEurekaService
and wait until you see "Service started and ready to process requests.." indicating that is had registered with eureka. - In the distribution run
./bin/ExampleEurekaClient
to run the example client.
An example service that registers itself with eureka.
The same as the ExampleEurekaService, where Governator/Guice is used to initialize everything. The gradle javaExec for this is ./gradlew :eureka-examples:runExampleGovernatedService
and the distribution generated script is ./bin/ExampleEurekaGovernatedService
An example use case of the eureka client to find a particular application/vip (in this case the example service) via eureka for communication.