JsonApiClient v3.1.1 JsonApiClient.Middleware.Fuse View Source
Circuit Breaker middleware using fuse. In order to use this middleware the
fuse package must be added to your mix project and the fuse
and sasl
applications must be started. e.g:
defp deps do
[
{:fuse, "~> 2.4"}
]
end
defp applications do
[
extra_applications: [:sasl, :fuse]
]
end
Options
service_name -> :opts
- fuse options per service:opts
- fuse options when options are not configured per service (see fuse docs for reference)
config :json_api_client,
middlewares: [
{JsonApiClient.Middleware.Fuse,
opts: {{:standard, 2, 10_000}, {:reset, 60_000}},
service1: {{:standard, 10, 5_000}, {:reset, 120_000}},
}
]
In this example we’re specifying the default fuse options with opts
and
then specifying different fuse options for the service1
fuse. Fuses are
named based on the service_name
of the request, if present.