All Projects → spring-cloud-samples → fortune-teller

spring-cloud-samples / fortune-teller

Licence: other
Yet another great Spring Cloud sample app...

Programming Languages

java
68154 projects - #9 most used programming language
HTML
75241 projects
javascript
184084 projects - #8 most used programming language
perl
6916 projects

Fortune Teller

Fortune Teller is a very basic application composed of two services:

  1. Fortune Service - serves up random Chinese fortune cookie fortunes

  2. Fortune UI - presents a UI that consumes the fortune service

It leverages libraries and services from Spring Cloud and Netflix OSS to compose the system.

Note
Want to deploy Fortune Teller to Pivotal Cloud Foundry environments that have installed the Spring Cloud Services package? See the SCS version of Fortune Teller.

Build

  1. Using Maven, build and package the application:

    $ mvn clean package

    Maven will automatically download all of Fortune Teller's dependencies. This may take a few moments.

Run

  1. Start the Config Server

    $ cd fortune-teller-config-server
    $ mvn spring-boot:run
  2. Start the Eureka Service

    $ cd fortune-teller-eureka
    $ mvn spring-boot:run
  3. Start the Hystrix Dashboard

    $ cd fortune-teller-hystrix-dashboard
    $ mvn spring-boot:run
  4. Start the Fortunes Service

    $ cd fortune-teller-fortune-service
    $ mvn spring-boot:run
  5. Start the Fortunes UI

    $ cd fortune-teller-ui
    $ mvn spring-boot:run

Test the Application

  1. In a browser, access the fortunes-ui application at http://localhost:8081/

    fortunes 1

  2. Now, in another browser tab, access the Hystrix Dashboard at http://localhost:7979/hystrix/. Enter the route for the UI application, http://localhost:8081/hystrix.stream, and click the ``Monitor Stream.''

    fortunes 2

  3. Access the fortunes-ui and show that the circuit breaker is registering successful requests.

    fortunes 3

  4. Stop the fortunes application

  5. Access the fortunes-ui and see that the ``fallback fortune'' is being returned.

    fortunes 4

  6. Access the fortunes-ui and show that the circuit breaker is registering short-circuited requests.

    fortunes 5

  7. Restart the fortunes application

  8. Continue to access the fortunes-ui and watch the dashboard. After the fortunes service has re-registered with Eureka and the fortunes-ui load balancer caches are refreshed, you will see the circuit breaker recover. You should then start getting random fortunes again!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].