Skip to content

A small Clojure wrapper around the resilience4j CircuitBreaker module

License

Notifications You must be signed in to change notification settings

tessellator/resilience4clj-circuitbreaker

Repository files navigation

resilience4clj-circuitbreaker

A small Clojure wrapper around the resilience4j CircuitBreaker module.

Requires Clojure 1.5 or later for JDK 8, and Clojure 1.10 or later for JDK 9+.

clojars badge cljdoc badge

Quick Start

The following code defines a function make-remote-call that uses a circuit breaker named :some-name and stored in the default registry. If the circuit breaker does not already exist, one is created.

(ns myproject.some-client
  (:require [clj-http.client :as http]
            [resilience4clj.circuit-breaker :refer [with-circuit-breaker]])

(defn make-remote-call []
  (with-circuit-breaker :some-name
    (http/get "https://www.example.com")))

Refer to the configuration guide for more information on how to configure the default registry as well as individual circuit breakers.

Refer to the usage guide for more information on how to use circuit breakers to protect code as well as how to manually manage the state on a circuit breaker.

License

Copyright © 2019-2022 Thomas C. Taylor and contributors.

Distributed under the Eclipse Public License version 2.0.

About

A small Clojure wrapper around the resilience4j CircuitBreaker module

Topics

Resources

License

Stars

Watchers

Forks

Languages