Functions to create and execute bulkheads.
Functions to create and execute bulkheads.
(bulkhead name config)
Creates a semaphore-based bulkhead with the specified name and config.
Creates a semaphore-based bulkhead with the specified name and config.
(bulkhead! name)
(bulkhead! name config)
Creates or fetches a bulkhead with the specified name and config and stores it in the global registry.
The config value can be either a config map compatible with the current registry (e.g., semaphore-based configs for a semaphore-based registry) or the name of a config map stored in the global registry.
If the bulkhead already exists in the global registry, the config value is ignored.
Creates or fetches a bulkhead with the specified name and config and stores it in the global registry. The config value can be either a config map compatible with the current registry (e.g., semaphore-based configs for a semaphore-based registry) or the name of a config map stored in the global registry. If the bulkhead already exists in the global registry, the config value is ignored.
(change-config! bulkhead config)
Changes the configuration of the bulkhead.
A change in :max-wait-duration
will not affect functions currently waiting
for permission to execute.
Changes the configuration of the bulkhead. A change in `:max-wait-duration` will not affect functions currently waiting for permission to execute.
(configure-registry! new-registry)
Overwrites the global registry with new-registry
.
Overwrites the global registry with `new-registry`.
(execute bulkhead f & args)
Apply args to f within a context protected by the bulkhead.
The function will wait up to the configuration wait duration if the bulkhead has no available concurrent calls remaining. If the function is not allowed to execute before the wait duration expires, this function will throw an exception.
Apply args to f within a context protected by the bulkhead. The function will wait up to the configuration wait duration if the bulkhead has no available concurrent calls remaining. If the function is not allowed to execute before the wait duration expires, this function will throw an exception.
(name bulkhead)
Gets the name of the bulkhead.
Gets the name of the bulkhead.
The global bulkhead and config registry.
By default, this registry works with semaphore-based bulkheads. If you prefer
to use thread-pool-based bulkheads, use call thread-pool-registry
and use
configure-registry!
to update this value.
The global bulkhead and config registry. By default, this registry works with semaphore-based bulkheads. If you prefer to use thread-pool-based bulkheads, use call `thread-pool-registry` and use `configure-registry!` to update this value.
(semaphore-registry configs-map)
Creates a registry for semaphore-based bulkheads.
configs-map is a map whose keys are names and vals are semaphore configs. When a bulkhead is created, you may specify one of the names in this map to use as the config for the bulkhead.
:default is a special name. It will be used as the config for bulkheads that do not specify a config to use.
Creates a registry for semaphore-based bulkheads. configs-map is a map whose keys are names and vals are semaphore configs. When a bulkhead is created, you may specify one of the names in this map to use as the config for the bulkhead. :default is a special name. It will be used as the config for bulkheads that do not specify a config to use.
(thread-pool-bulkhead name thread-pool-config-map)
Creates a thread-pool-based bulkhead with the specified name and config.
Creates a thread-pool-based bulkhead with the specified name and config.
(thread-pool-registry thread-pool-configs-map)
Creates a registry for thread-pool-based bulkheads and configs.
thread-pool-configs-map is a map whose keys are names and vals are thread-pool configs. When a bulkhead is created, you may specify one of the names in this map to use as the config for the bulkhead.
:default is a special name. It will be used as the config for bulkheads that do not specify a config to use.
Creates a registry for thread-pool-based bulkheads and configs. thread-pool-configs-map is a map whose keys are names and vals are thread-pool configs. When a bulkhead is created, you may specify one of the names in this map to use as the config for the bulkhead. :default is a special name. It will be used as the config for bulkheads that do not specify a config to use.
(with-bulkhead bulkhead & body)
Executes body within a context protected by a bulkhead.
bulkhead
is either a bulkhead or the name of one in the global registry.
If you provide a name and a bulkhead of that name does not already exist in
the global registry, one will be created with the :default
config.
The code in body
will wait up to the configured wait duration if the
bulkhead as no available concurrent calls remaining. If the function is not
allowed to execute before the wait duration expires, an exception will be
thrown.
Executes body within a context protected by a bulkhead. `bulkhead` is either a bulkhead or the name of one in the global registry. If you provide a name and a bulkhead of that name does not already exist in the global registry, one will be created with the `:default` config. The code in `body` will wait up to the configured wait duration if the bulkhead as no available concurrent calls remaining. If the function is not allowed to execute before the wait duration expires, an exception will be thrown.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close