Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.
/ resilience Public archive

A scala DSL for Netflix Hystrix for building resilient applications

License

Notifications You must be signed in to change notification settings

ppat/resilience

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
}

About

A scala DSL for Netflix Hystrix for building resilient applications

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages