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

Scala toolset for microservice resilience patterns, inspired from resilience4j Java library.

License

Notifications You must be signed in to change notification settings

lprakashv/resilience4s

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

resilience4s

Scala toolset for microservice resilience patterns, inspired from resilience4j Java library.

Examples

  • Circuit => A circuit specification for circuit-breaker design pattern.

    Usage:

import scala.concurrent.Future
import com.lprakashv.resilience4s.circuitbreaker._
import scala.concurrent.duration._
import java.util.logging.Logger
import scala.util.Random

val myCircuit = new Circuit[Int](
  "sample-circuit", 
   5, 
   5.seconds,
   1, 
   -1,
   Logger.getGlobal
)

def doThingAndReturnInt: Int = ??? //method to wrap

def doThingAndReturnIntF: Future[Int] = ??? //async method to wrap

myCircuit.execute(doThingAndReturnInt)

myCircuit.executeAsync(doThingAndReturnIntF)

myCircuit.execute {
  val x = 23
  //.. do something here
  ???
  val y = Random.between(1, 1000)
  x / y
}

//others methods like
import com.lprakashv.resilience4s.circuitbreaker.CircuitImplicits._

implicit val circuit: Circuit[String] = ???

def f: String = ???
def ff: Future[String] = ???

f.execute

ff.executeAsync

About

Scala toolset for microservice resilience patterns, inspired from resilience4j Java library.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages