bijukunjummen / spring-cloud-bus-sample

Demo project for Spring Cloud Bus

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spring Cloud Bus Demo

This is a simple demonstration of Spring Cloud Bus feature of being able to refresh properties in all instances of an application

Start up RabbitMQ Server
rabbitmq-server
Start up Config Server
cd sample-config
mvn spring-boot:run
Start up Service instance 1
cd sample-service
mvn spring-boot:run
Start up Service instance 2
cd sample-service
mvn spring-boot:run -Dserver.port=8081

If all the applications have come up cleanly, the endpoint should be available at http://localhost:8080/show, http://localhost:8081/show

  1. To change the property, open sample-config/src/main/resources/config/sample-service.yml and modify service.prop value and restart config server

  2. The change will not reflect in the the applications

  3. Now refresh the properties using a POST request:

curl -X POST http://localhost:8080/bus/refresh
  1. The changed property should now reflect on all instances of the application.

About

Demo project for Spring Cloud Bus


Languages

Language:Java 100.0%