vaslabs / talos

Lawful circuit breakers for Scala. Akka and monix circuit breaker implementations with monitoring.


talos Build Status Maven Central Codacy Badge Codacy Badge Docker hub Known Vulnerabilities Join the chat at

Talos is enforcing some theory from literature concerning circuit breakers in the form of typeclasses and laws.

Read more around the theory here

The main deliverable of Talos is fine grained monitoring.


Talos is modularised. You can twist it and pick the dependencies that fit your need. But let's go step by step.

libraryDependencies += "org.vaslabs.talos" %% "taloscore" % "1.0.0"
libraryDependencies += "org.vaslabs.talos" %% "talosakkasupport" % "1.0.0"
libraryDependencies += "org.vaslabs.talos" %% "taloskamon" % "1.0.0"
libraryDependencies += "org.vaslabs.talos" %% "hystrixreporter" % "1.0.0"

The events library provides a way to stream events on what's happening in the circuit breakers. E.g. combining with the talosakkasupport you can do:

import{ActorSystem, ActorRef}
import akka.pattern.CircuitBreaker
import cats.effect.IO
import talos.circuitbreakers.TalosCircuitBreaker
import talos.circuitbreakers.akka._

import scala.concurrent.duration._

def createCircuitBreaker(name: String = "testCircuitBreaker")
                      (implicit system: ActorSystem[_]): AkkaCircuitBreaker.Instance = {
        2 seconds,
        5 seconds

If you have an existing solution based on Akka circuit breaker and you can extract the circuit breaker like this.

    val akkaCB: CircuitBreaker = talosCircuitBreaker.circuitBreaker.unsafeRunSync()

Otherwise you can use the TalosCircuitBreaker typeclass directly

    val action: IO[Unit] = talosCircuitBreaker.protect(IO(println("Running inside the circuit breaker")))

Talos also supports the CircuitBreaker from monix

Shipping circuit breaker events with hystrix reporter

Get an akka directive

import akka.http.scaladsl.server.Route

val hystrixReporterDirective: Route  = new HystrixReporterDirective()

And you can mix the Akka directive with the rest of your application.

Complete usage example

How to code can be found here:


If you wish to implement your own TalosCircuitBreaker typeclasses you can test them against the laws library:

libraryDependencies += "org.vaslabs.talos" %% "taloslaws" % "1.0.0" % Test

Run the demo

  • Spin up the docker images provided:
cd examples
docker-compose up

alt text


alt text