{"id":15439508,"url":"https://github.com/joelittlejohn/clj-http-hystrix","last_synced_at":"2025-06-27T20:32:53.258Z","repository":{"id":21776089,"uuid":"25098403","full_name":"joelittlejohn/clj-http-hystrix","owner":"joelittlejohn","description":"A Clojure library to wrap clj-http requests as hystrix commands","archived":false,"fork":false,"pushed_at":"2019-10-27T21:52:42.000Z","size":61,"stargazers_count":22,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-19T19:47:46.508Z","etag":null,"topics":["circuit-breaker","clj-http","clojure","http-client","hystrix","microservices"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joelittlejohn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-11T22:55:43.000Z","updated_at":"2024-02-22T11:22:26.000Z","dependencies_parsed_at":"2022-08-17T19:35:25.288Z","dependency_job_id":null,"html_url":"https://github.com/joelittlejohn/clj-http-hystrix","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/joelittlejohn/clj-http-hystrix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joelittlejohn%2Fclj-http-hystrix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joelittlejohn%2Fclj-http-hystrix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joelittlejohn%2Fclj-http-hystrix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joelittlejohn%2Fclj-http-hystrix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joelittlejohn","download_url":"https://codeload.github.com/joelittlejohn/clj-http-hystrix/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joelittlejohn%2Fclj-http-hystrix/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260857231,"owners_count":23073423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["circuit-breaker","clj-http","clojure","http-client","hystrix","microservices"],"created_at":"2024-10-01T19:07:05.010Z","updated_at":"2025-06-27T20:32:53.194Z","avatar_url":"https://github.com/joelittlejohn.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# clj-http-hystrix [![Build Status](https://travis-ci.org/joelittlejohn/clj-http-hystrix.svg?branch=master)](https://travis-ci.org/joelittlejohn/clj-http-hystrix) [![Coverage Status](https://coveralls.io/repos/joelittlejohn/clj-http-hystrix/badge.svg?branch=master)](https://coveralls.io/r/joelittlejohn/clj-http-hystrix?branch=master)\n\n![latest version](https://clojars.org/clj-http-hystrix/latest-version.svg)\n\nA Clojure library to wrap clj-http requests as [hystrix](https://github.com/Netflix/Hystrix) commands whenever a request options map includes `:hystrix/...` keys.\n\n## Usage\n\nWhen you start your app, add:\n\n```clj\n(clj-http-hystrix.core/add-hook)\n```\n\nWhenever you make an http request, add **one or more** of the hystrix-clj options to your options map, e.g.:\n\n```clj\n(http/get \"http://www.google.com\" {:hystrix/command-key             :default\n                                   :hystrix/fallback-fn             default-fallback\n                                   :hystrix/group-key               :default\n                                   :hystrix/threads                 10\n                                   :hystrix/queue-size              5\n                                   :hystrix/timeout-ms              1000\n                                   :hystrix/breaker-request-volume  20\n                                   :hystrix/breaker-error-percent   50\n                                   :hystrix/breaker-sleep-window-ms 5000\n                                   :hystrix/bad-request-pred        client-error?})\n```\n\nRequests 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.\n\nCustom default values can be specified when registering with `add-hook`. Any keys you supply will override the defaults shown above:\n\n```clj\n(clj-http-hystrix.core/add-hook {:hystrix/timeout-ms 2500\n                                 :hystrix/queue-size 12})\n```\n\n## Bad requests\n\nHystrix 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 service\u003csup\u003e[1](https://github.com/Netflix/Hystrix/wiki/How-To-Use#error-propagation)\u003c/sup\u003e. 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 \u0026 response, then the failure will be considered a 'bad request' (and not counted towards the failure metrics for a command).\n\nBy 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 provided\u003csup\u003e[2](https://github.com/joelittlejohn/clj-http-hystrix/blob/18a4f8f9636e531558a57557681c5d5861b27e42/src/clj_http_hystrix/core.clj#L67)\u003c/sup\u003e.\n\n## Cached vs dynamic configuration\n\nHystrix 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.\n\nThe 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.\n\n## License\n\nCopyright © 2014 Joe Littlejohn, Mark Tinsley\n\nDistributed under the Eclipse Public License either version 1.0 or (at\nyour option) any later version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoelittlejohn%2Fclj-http-hystrix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoelittlejohn%2Fclj-http-hystrix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoelittlejohn%2Fclj-http-hystrix/lists"}