All Projects → joelittlejohn → clj-http-hystrix

joelittlejohn / clj-http-hystrix

Licence: EPL-1.0 license
A Clojure library to wrap clj-http requests as hystrix commands

Programming Languages

clojure
4091 projects
shell
77523 projects

Projects that are alternatives of or similar to clj-http-hystrix

Brakes
Hystrix compliant Node.js Circuit Breaker Library
Stars: ✭ 255 (+1114.29%)
Mutual labels:  hystrix, circuit-breaker
Sample Camel Spring Boot
three samples in different branches that illustrates usage of apache camel as microservice framework providing integration with consul, hystrix, ribbon and other tools
Stars: ✭ 24 (+14.29%)
Mutual labels:  hystrix, circuit-breaker
Hystrix.Dotnet
A combination of circuit breaker and timeout. The .net version of the open source Hystrix library built by Netflix.
Stars: ✭ 88 (+319.05%)
Mutual labels:  hystrix, circuit-breaker
pyhystrix
Hystrix brought to Python
Stars: ✭ 21 (+0%)
Mutual labels:  hystrix, circuit-breaker
spring-microservices
Spring Cloud Micro Services with Eureka Discovery, Zuul Proxy, OAuth2 Security, Hystrix CircuitBreaker, Sleuth Zipkin, ELK Stack Logging, Kafka, Docker and many new features
Stars: ✭ 114 (+442.86%)
Mutual labels:  hystrix, circuit-breaker
Heimdall
An enhanced HTTP client for Go
Stars: ✭ 2,132 (+10052.38%)
Mutual labels:  hystrix, circuit-breaker
Opossum
Node.js circuit breaker - fails fast ⚡️
Stars: ✭ 473 (+2152.38%)
Mutual labels:  hystrix, circuit-breaker
microservices-developer-roadmap
Roadmap for becoming a Microservice Developer in 2017
Stars: ✭ 24 (+14.29%)
Mutual labels:  hystrix, circuit-breaker
request-on-steroids
An HTTP client ✨ with retry, circuit-breaker and tor support 📦 out-of-the-box
Stars: ✭ 19 (-9.52%)
Mutual labels:  http-client, circuit-breaker
yato
A node module similar to hystrix. Who caused riots - cut it!
Stars: ✭ 12 (-42.86%)
Mutual labels:  hystrix, circuit-breaker
Connectors
Connectors simplify connecting to standalone and CloudFoundry services
Stars: ✭ 28 (+33.33%)
Mutual labels:  hystrix, circuit-breaker
gobreak
Latency and fault tolerance library like Netflix's Hystrix with prometheus and gobreaker.
Stars: ✭ 42 (+100%)
Mutual labels:  hystrix, circuit-breaker
bow-openapi
🌐 Functional HTTP client generator from an OpenAPI/Swagger specification.
Stars: ✭ 47 (+123.81%)
Mutual labels:  http-client
domhttpx
domhttpx is a google search engine dorker with HTTP toolkit built with python, can make it easier for you to find many URLs/IPs at once with fast time.
Stars: ✭ 59 (+180.95%)
Mutual labels:  http-client
swish
C++ HTTP requests for humans
Stars: ✭ 52 (+147.62%)
Mutual labels:  http-client
minreq
Simple, minimal-dependency HTTP client.
Stars: ✭ 91 (+333.33%)
Mutual labels:  http-client
spring-cloud-circuitbreaker-demo
Samples demonstrating how to using Spring Cloud Circuitbreaker
Stars: ✭ 43 (+104.76%)
Mutual labels:  circuit-breaker
hunt-http
http library for D, support http 1.1 / http 2.0 (http2) / websocket server and client.
Stars: ✭ 29 (+38.1%)
Mutual labels:  http-client
feign-opentracing
OpenTracing Feign integration
Stars: ✭ 20 (-4.76%)
Mutual labels:  http-client
fitch.js
A lightweight Promise based HTTP client, using Fetch API.
Stars: ✭ 35 (+66.67%)
Mutual labels:  http-client

clj-http-hystrix Build Status Coverage Status

latest version

A Clojure library to wrap clj-http requests as hystrix commands whenever a request options map includes :hystrix/... keys.

Usage

When you start your app, add:

(clj-http-hystrix.core/add-hook)

Whenever you make an http request, add one or more of the hystrix-clj options to your options map, e.g.:

(http/get "http://www.google.com" {:hystrix/command-key             :default
                                   :hystrix/fallback-fn             default-fallback
                                   :hystrix/group-key               :default
                                   :hystrix/threads                 10
                                   :hystrix/queue-size              5
                                   :hystrix/timeout-ms              1000
                                   :hystrix/breaker-request-volume  20
                                   :hystrix/breaker-error-percent   50
                                   :hystrix/breaker-sleep-window-ms 5000
                                   :hystrix/bad-request-pred        client-error?})

Requests without any :hystrix/... keys won't use Hystrix. If you include at least one :hystrix/... key then any keys not specified will take the above (default) values.

Custom default values can be specified when registering with add-hook. Any keys you supply will override the defaults shown above:

(clj-http-hystrix.core/add-hook {:hystrix/timeout-ms 2500
                                 :hystrix/queue-size 12})

Bad requests

Hystrix allows some failures to be marked as bad requests, that is, requests that have failed because of a badly formed request rather than an error in the downstream service1. clj-http-hystrix allows a predicate to be supplied under the :hystrix/bad-request-pred key, and if this predicate returns true for a given request & response, then the failure will be considered a 'bad request' (and not counted towards the failure metrics for a command).

By default, all client errors (4xx family of response codes) are considered Hystrix bad requests and are not counted towards the failure metrics for a command. There are some useful predicates and predicate generators provided2.

Cached vs dynamic configuration

Hystrix caches configuration for a command and hence there are limits to how this library can react to configuration options that vary dynamically. For a given command-key, the :hystrix/timeout-ms will be fixed on first use. This means it's a bad idea to reuse the :hystrix/command-key value in many parts of your app. When you want a new configuration, you should use a new :hystrix/command-key value.

The same is true for thread pools - configuration is cached per :hystrix/group-key, so if you need to use a different value for :hystrix/queue-size or :hystrix/threads then you should use a new :hystrix/group-key value.

License

Copyright © 2014 Joe Littlejohn, Mark Tinsley

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].