Giter Club home page Giter Club logo

fuse-circuitbreaker's Introduction

Circuit Breaker - Fuse Booster

Overview

The Fuse circuit breaker booster consists of two related services:

  • A name service, which returns a name to greet, and

  • A greetings service, which invokes the name service to get a name and then returns the string, Hello, NAME.

In this demonstration, the Hystrix circuit breaker is inserted between the greetings service and the name service. If the name service becomes unavailable, the greetings service can fall back to an alternative behaviour and respond to the client immediately, instead of blocking while it waits for the name service to restart.

Deployment options

This booster can run in the following modes:

The most effective way to demonstrate the circuit breaker is to deploy and run the project on OpenShift. For more details about running this booster on a single-node OpenShift cluster, CI/CD deployments, as well as the rest of the runtime, see the Spring Boot Runtime Guide.

Important
This booster requires Java 8 JDK or greater and Maven 3.3.x or greater.

Running the booster standalone on your machine

You can run this booster as a standalone project on your local machine:

  1. Download the project and extract the archive on your local filesystem.

  2. Build the project:

    $ cd PROJECT_DIR
    $ mvn clean package
  3. In two separate shell prompts, run the services as follows:

    $ cd name-service
    $ mvn spring-boot:run -Dserver.port=8081

    and

    $ cd greetings-service
    $ mvn spring-boot:run
  4. Visit http://localhost:8080 and follow the instructions on that page.

Running the booster on a single-node OpenShift cluster

If you have a single-node OpenShift cluster, such as Minishift or the Red Hat Container Development Kit, installed and running, you can deploy your booster there. A single-node OpenShift cluster provides you with access to a cloud environment that is similar to a production environment.

Important
You need to run this example on Container Development Kit 3.3 or OpenShift 3.7. Both of these products have suitable Fuse images pre-installed. If you run it in an evironment where those images are not preinstalled follow the steps described in Running the booster on a single-node OpenShift cluster without preinstalled images.

To deploy your booster to a running single-node OpenShift cluster:

  1. Download the project and extract the archive on your local filesystem.

  2. Log in to your OpenShift cluster:

    $ oc login -u developer -p developer
  3. Create a new OpenShift project for the booster:

    $ oc new-project MY_PROJECT_NAME
  4. Build and deploy the project to the OpenShift cluster:

    $ mvn clean -DskipTests fabric8:deploy -Popenshift
  5. In your browser, navigate to the MY_PROJECT_NAME project in the OpenShift console. Wait until you can see that the pods for the name-service application and for the greetings-service application have both started up.

  6. Just above the entry for the greetings-service application on the Overview page, there is a URL of the form http://greetings-service-MY_PROJECT_NAME.OPENSHIFT_IP_ADDR.nip.io. Click on the URL to access the greetings service application and follow the instructions on that page.

Running the booster on a single-node OpenShift cluster without preinstalled images

To deploy your booster to a running single-node OpenShift cluster without preinstalled images:

  1. Download the project and extract the archive on your local filesystem.

  2. Log in to your OpenShift cluster:

    $ oc login -u developer -p developer
  3. Create a new OpenShift project for the booster:

    $ oc new-project MY_PROJECT_NAME
  4. Import base images in your newly created project (MY_PROJECT_NAME):

    $ oc import-image fis-java-openshift:2.0 --from=registry.access.redhat.com/fuse7/fuse-java-openshift:1.0 --confirm
  5. Build and deploy the project to the OpenShift cluster:

    $ mvn clean -DskipTests fabric8:deploy -Popenshift -Dfabric8.generator.fromMode=istag -Dfabric8.generator.from=MY_PROJECT_NAME/fis-java-openshift:2.0
  6. In your browser, navigate to the MY_PROJECT_NAME project in the OpenShift console. Wait until you can see that the pods for the name-service application and for the greetings-service application have both started up.

  7. Just above the entry for the greetings-service application on the Overview page, there is a URL of the form http://greetings-service-MY_PROJECT_NAME.OPENSHIFT_IP_ADDR.nip.io. Click on the URL to access the greetings service application and follow the instructions on that page.

Running the booster on OpenShift Online

You can deploy the circuit breaker booster directly to OpenShift Online when you create the project at https://developers.redhat.com/launch.

  1. Visit https://developers.redhat.com/launch.

  2. At the Deployment step, select Use OpenShift Online.

  3. Follow the on-screen instructions to create a new Circuit Breaker project using the Fuse runtime.

Note
As part of the process of creating this booster, https://developers.redhat.com/launch sets up a project with a CI/CD deployment of this booster. You can see the status of this deployment in your Single-node OpenShift Cluster or OpenShift Online Web Console.

fuse-circuitbreaker's People

Contributors

openshiftio-launchpad avatar

Watchers

 avatar  avatar

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.