Liking cljdoc? Tell your friends :D

net.modulolotus.truegrit

Primary namespace for using True Grit.

Contains all-in-one functions that take a fn and a config map, and return a wrapped fn with the fault tolerance policy attached. All wrapped fns return the same results, except for thread-pool-based bulkheads which return Futures. This ns is best for simple use cases. For additional fns and more fine-tuned control, see the individual policy namespaces.

Important: Before using, be sure to understand how Resilience4j works, and in particular, the way circuit breakers operate.

For circuit breakers or bulkheads, you should be careful to only create them once. Since those resilience policies keep state that is only meaningful across multiple function calls, dynamically wrapping a fn with a brand-new strategy by accident is incorrect. E.g., a new CB is always good for the first n calls, but a pre-existing CB may know that the underlying service is down. With other policies, dynamic recreation will result in a lot of churn and memory pressure, but they will still operate as expected.

Be mindful of interactions at different levels of the system. E.g., wrapping a high-level fn with a retry strategy of 3 attempts that calls a network client lower down that also has its own retry strategy of 3 attempts can result in up to 3x3=9 calls when failing, exacerbating things.

Order of wrapping matters. E.g.:

(-> my-fn
    (with-retry some-retry-config)
    (with-time-limiter some-timeout-config)

will retry several times, but if the time is up before a try succeeds, it will return failure. This is probably not what you want. On the other hand:

(-> my-fn
    (with-time-limiter some-timeout-config)
    (with-retry some-retry-config)

will make calls with a certain time limit, and only if they return failure or exceed their time limit, will it attempt a retry.

Primary namespace for using True Grit.

Contains all-in-one functions that take a fn and a config map, and return a wrapped fn with the fault
tolerance policy attached. All wrapped fns return the same results, except for thread-pool-based bulkheads
which return Futures. This ns is best for simple use cases. For additional fns and more fine-tuned control,
see the individual policy namespaces.

Important: Before using, be sure to understand how Resilience4j works, and in particular, the way circuit
breakers operate.

For circuit breakers or bulkheads, you should be careful to only create them once. Since those resilience
policies keep state that is only meaningful across multiple function calls, dynamically wrapping a fn
with a brand-new strategy by accident is incorrect. E.g., a new CB is *always* good for the first
n calls, but a pre-existing CB may know that the underlying service is down. With other policies, dynamic
recreation will result in a lot of churn and memory pressure, but they will still operate as expected.

Be mindful of interactions at different levels of the system. E.g., wrapping a high-level fn with a retry
strategy of 3 attempts that calls a network client lower down that also has its _own_ retry strategy of 3
attempts can result in up to 3x3=9 calls when failing, exacerbating things.

Order of wrapping matters. E.g.:

```clojure
(-> my-fn
    (with-retry some-retry-config)
    (with-time-limiter some-timeout-config)
```

will retry several times, but if the time is up before a try succeeds, it will return failure. This is
probably not what you want. On the other hand:

```clojure
(-> my-fn
    (with-time-limiter some-timeout-config)
    (with-retry some-retry-config)
```

will make calls with a certain time limit, and only if they return failure or exceed their time limit, will
it attempt a retry.
raw docstring

net.modulolotus.truegrit.bulkhead

Implements semaphore-based bulkheads.

See https://resilience4j.readme.io/docs/bulkhead

Implements semaphore-based bulkheads.

See https://resilience4j.readme.io/docs/bulkhead
raw docstring

net.modulolotus.truegrit.circuit-breaker

Implements circuit breakers, which keep track of fn failures and temporarily disable a fn when it fails too often.

See https://resilience4j.readme.io/docs/circuitbreaker

Implements circuit breakers, which keep track of fn failures and temporarily disable
a fn when it fails too often.

See https://resilience4j.readme.io/docs/circuitbreaker
raw docstring

net.modulolotus.truegrit.rate-limiter

Implements rate limiters, which throttle fns that are called too often.

See https://resilience4j.readme.io/docs/ratelimiter

Implements rate limiters, which throttle fns that are called too often.

See https://resilience4j.readme.io/docs/ratelimiter
raw docstring

net.modulolotus.truegrit.retry

Implements retries, which call a fn again when it fails (up to a limit).

See https://resilience4j.readme.io/docs/retry

Implements retries, which call a fn again when it fails (up to a limit).

See https://resilience4j.readme.io/docs/retry
raw docstring

net.modulolotus.truegrit.thread-pool-bulkhead

Implements thread-pool-based bulkheads. Due to tricky interactions with Clojure thread expectations, consider the default semaphore-based bulkhead instead, and take care when using.

See https://resilience4j.readme.io/docs/bulkhead

Implements thread-pool-based bulkheads. Due to tricky interactions with Clojure
thread expectations, consider the default semaphore-based bulkhead instead, and
take care when using.

See https://resilience4j.readme.io/docs/bulkhead
raw docstring

net.modulolotus.truegrit.time-limiter

Implements time limiters, aka timeouts, which throw exceptions if a fn takes too long to return.

See https://resilience4j.readme.io/docs/timeout

Implements time limiters, aka timeouts, which throw exceptions if a fn takes too long to return.

See https://resilience4j.readme.io/docs/timeout
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close