Giter Site home page Giter Site logo

resilience's Introduction

resilience

Build Status

“Do the things that interest you and do them with all your heart. Don't be concerned about whether people are 
watching you or criticizing you. The chances are that they aren't paying any attention to you. It's your 
attention to yourself that is so stultifying. But you have to disregard yourself as completely as possible. 
If you fail the first time then you'll just have to try harder the second time. After all, there's no real 
reason why you should fail. Just stop thinking about yourself.” 
                                                     ― Eleanor Roosevelt

A scala DSL for Netflix Hystrix for building resilient applications

Use

Build and add this to the your maven POM (or built.sbt for SBT)

        <dependency>
            <groupId>io.latent</groupId>
            <artifactId>resilience</artifactId>
            <version>LATEST-VERSION</version>
        </dependency>

Gracefully degrade

  • yes, that means throwing exception when underlying command
    • fails
    • times out
    • circuit breaker trips
    • thread pool is exhausted or semaphore max reached
import io.latent.resilience.HystrixConfig
import io.latent.resilience.HystrixDSL._

implicit val config = HystrixConfig("APP-NAME", "search-title-nationwide", Some(1 second))
gracefully {
   search(title, page, pageSize, matchAllFilter(), sort)
} degrade()

Gracefully fallback

  • you must have a fallback that actually makes SENSE in your use case for this option
import io.latent.resilience.HystrixConfig
import io.latent.resilience.HystrixDSL._

implicit val config = HystrixConfig("APP-NAME", "search-title-nationwide", Some(1 second))
gracefully {
  search(title, page, pageSize, matchAllFilter(), sort)
} fallback {
  List.empty
}

resilience's People

Contributors

ppat 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.