(execute execute-body & args)
Create a function with the execute-body
, applies any wrapper functions
in the args
and then executes it.
ex: (execute
(let [data (fetch-data-from db)]
(save data))
(with-breaker breaker)
(with-retry retry-policy)
(recover-from [CircuitBreakerOpenException ExceptionInfo]
(fn [_] (log/error "circuit breaker open")))
(recover (fn [ex] (log/error ex "unexpected exception happened"))))
Create a function with the `execute-body`, applies any wrapper functions in the `args` and then executes it. ex: (execute (let [data (fetch-data-from db)] (save data)) (with-breaker breaker) (with-retry retry-policy) (recover-from [CircuitBreakerOpenException ExceptionInfo] (fn [_] (log/error "circuit breaker open"))) (recover (fn [ex] (log/error ex "unexpected exception happened"))))
(execute-callable* f)
Internal use only. Sorry for not founding a way to conceal it.
Internal use only. Sorry for not founding a way to conceal it.
(execute-with-breaker breaker & body)
Execute the following codes with the protection
of a circuit breaker given by breaker
argument.
Please try to not put clojure.core/recur
in body
otherwise you may get an infinite loop easily.
Execute the following codes with the protection of a circuit breaker given by `breaker` argument. Please try to not put `clojure.core/recur` in `body` otherwise you may get an infinite loop easily.
(execute-with-bulkhead bulkhead & body)
Execute the following codes with the protection
of a bulkhead given by bulkhead
argument.
Please try to not put clojure.core/recur
in body
otherwise you may get an infinite loop easily.
Execute the following codes with the protection of a bulkhead given by `bulkhead` argument. Please try to not put `clojure.core/recur` in `body` otherwise you may get an infinite loop easily.
(execute-with-retry retry & body)
Execute the following codes with the protection
of a retry policy given by retry
argument.
Please try to not put clojure.core/recur
in body
otherwise you may get an infinite loop easily.
Execute the following codes with the protection of a retry policy given by `retry` argument. Please try to not put `clojure.core/recur` in `body` otherwise you may get an infinite loop easily.
(execute-with-time-limiter timelimiter & body)
Execute the following codes with the protection
of a time limiter given by time-limiter
argument.
Please try to not put clojure.core/recur
in body
otherwise you may get an infinite loop easily.
Execute the following codes with the protection of a time limiter given by `time-limiter` argument. Please try to not put `clojure.core/recur` in `body` otherwise you may get an infinite loop easily.
(recover wraped-fn)
(recover failover-fn wraped-fn)
Like resilience.core/recover-from
but will catch any exceptions inherited
from java.lang.Exception.
You can chose to provide a failover function which will be evaluated when any
exceptions occurred. If no failover function provided, then nil will
be returned any exceptions happened.
Like `resilience.core/recover-from` but will catch any exceptions inherited from java.lang.Exception. You can chose to provide a failover function which will be evaluated when any exceptions occurred. If no failover function provided, then nil will be returned any exceptions happened.
(recover-from exceptions wraped-fn)
(recover-from exceptions failover-fn wraped-fn)
Using with resilience.core/execute
to recover from enumerated exceptions list.
You can chose to provide a failover function which will be evaluated when one of
enumerated exception occurred. If no failover function provided, then nil will
be returned when exception happened.
Using with `resilience.core/execute` to recover from enumerated exceptions list. You can chose to provide a failover function which will be evaluated when one of enumerated exception occurred. If no failover function provided, then nil will be returned when exception happened.
(with-breaker breaker f)
Provide a function f
which has no arguments and returns a function
which is decorated by a circuit breaker given by breaker
argument.
Usually this is used within resilience.core/execute
block.
Provide a function `f` which has no arguments and returns a function which is decorated by a circuit breaker given by `breaker` argument. Usually this is used within `resilience.core/execute` block.
(with-bulkhead bulkhead f)
Provide a function f
which has no arguments and returns a function
which is decorated by a bulkhead given by bulkhead
argument.
Usually this is used within resilience.core/execute
block.
Provide a function `f` which has no arguments and returns a function which is decorated by a bulkhead given by `bulkhead` argument. Usually this is used within `resilience.core/execute` block.
(with-rate-limiter rate-limiter f)
Provide a function f
which has no arguments and returns a function
which is decorated by a rate limiter given by rate-limiter
argument.
Usually this is used within resilience.core/execute
block.
Provide a function `f` which has no arguments and returns a function which is decorated by a rate limiter given by `rate-limiter` argument. Usually this is used within `resilience.core/execute` block.
(with-resilience-family family-members & body)
Protected forms in body
with resilience family members.
ex: (with-resilience-family
[:retry retry-policy :breaker breaker :bulkhead bulkhead]
(let [data (fetch-data-from db)]
(save data)))
Please remember to catch Exceptions which may thrown from resilience family members.
Protected forms in `body` with resilience family members. ex: (with-resilience-family [:retry retry-policy :breaker breaker :bulkhead bulkhead] (let [data (fetch-data-from db)] (save data))) Please remember to catch Exceptions which may thrown from resilience family members.
(with-retry retry f)
Provide a function f
which has no arguments and returns a function
which is decorated by a retry policy given by retry
argument.
Usually this is used within resilience.core/execute
block.
Provide a function `f` which has no arguments and returns a function which is decorated by a retry policy given by `retry` argument. Usually this is used within `resilience.core/execute` block.
(with-time-limiter time-limiter f)
Provide a function f
which has no arguments and returns a function
which is decorated by a time limiter given by time-limiter
argument.
Usually this is used within resilience.core/execute
block.
Provide a function `f` which has no arguments and returns a function which is decorated by a time limiter given by `time-limiter` argument. Usually this is used within `resilience.core/execute` block.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close