Code Monkey home page Code Monkey logo

khs-hystrix-demo's Introduction

khs-hystrix-demo

Hystrix Demonstration Application, applies the Hystrix Circuit Breaker logic to example endpoints. Failures are baked into these example endpoints in order to demonstrate circuit breaker behaivor.

#How To Use This is a simple example of a hystrix enabled Java Spring application. To properly use this - import into STS Eclipse as a Maven project, and run the com.example.config.AppConfig.java as a Spring Boot Project.

This app is a headless service that has the following endpoints:

Note: random 500 errors are produced, so keep executing to get valid results.

http://{hostname}/api/payloads - GET

returns a ResponseEntity with a list of a sample JSON payload and the proper http code,

http://{hostname}/api/payloads/hystrix - GET

returns a ResponseEntity with a list of a sample JSON payload and the proper http code from hystrix enabled commands

http://{hostname}/api/payloads/fail - GET

returns a ResponseEntity with a list of a sample JSON payload and the proper http code from normal service endpoints desinged to fail

http://{hostname}/api/payloads/fail/hystrix - GET

returns a ResponseEntity with a list of a sample JSON payload and the proper http code from hystrix enabled command endpoints desinged to fail

#How to Test

All of these endpoints can be tested from postman (a google chrome app) to see the sample returns. To help ensure that failures are seen, these service are very unreliable. At random intervals every service throw an exception. To see how these behave it is most easily illustrated by having your Spring service console open so you can read the application logs on your screen, then right next to that (or on another monitor if you have one) exercise the endpoints in postman. Send several messages to each endpoint over and over again by clicking multiple times. This will illustrate how normal failures would appear and how hystrix failures would appear.

This app also has a test project that has a single MockMVC test that can be run as a jUnit test that will spit out logs that demonstrate the different behaviors and messaging that these implementations report.

#How to see metrics The hystrix stream and health endpoints are exposed for this app and can be accessed via the following endpoints:

http://{hostname}/api/health

http://{hostname}/api/hystrix.stream

These can also be used in tandem with a hystrix dashboard to visualize the data and status of the app. The repo for Hystrix Dashboard is:

https://github.com/spring-cloud-samples/hystrix-dashboard.git

#Disclaimer This project should not be used in production.

This project does not conform to pure rest standards.

This is a contrived project with contrived returns, don't take it too seriously.

#More Information

If you want more - please see the following links:

https://github.com/Netflix/Hystrix

http://cloud.spring.io/spring-cloud-netflix/spring-cloud-netflix.html

https://github.com/Netflix/Hystrix/tree/master/hystrix-contrib/hystrix-javanica

https://keyholesoftware.com/2016/02/01/hystrix-to-prevent-hysterix/

khs-hystrix-demo's People

Contributors

monsondallas avatar dpitt avatar

Watchers

Rob Winch avatar James Cloos avatar

Forkers

ptalele

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.