Skip to content

tessellator/resilience4clj-bulkhead

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

resilience4clj-bulkhead

A small Clojure wrapper around the resilience4j Bulkhead module. Requires Clojure 1.9 or later.

clojars badge cljdoc badge

Quick Start

The following code defines a function make-remote-call that will limit the number of concurrent calls to an external service using a bulkhead named :my-bulkhead in the global registry. If the bulkhead does not already exist in the global registry, one is created.

If a call would cause the bulkhead to exceed the maximum number of allowable concurrent calls, that call will instead wait for permission to execute. If the call does not receive permission to execute before a timeout period expires, an exception will be thrown.

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

(defn make-remote-call []
  (with-bulkhead :my-bulkhead
    (http/get "https://www.example.com")))

Refer to the configuration guide for more information on how to configure the global registry as well as individual bulkheads.

Refer to the usage guide for more information on how to use bulkheads.

License

Copyright © 2020 Thomas C. Taylor and contributors.

Distributed under the Eclipse Public License version 2.0.

About

A small Clojure wrapper around the resilience4j Bulkhead module

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published