(async-call this f & args)Asynchronously calls (apply f args). Returns a core.async channel that will receive:
Asynchronously calls (apply f args). Returns a core.async channel that will receive: - the result (any value) on success - Throwable/js.Error on failure (validation, dispatch, transport, or timeout)
(-async-call this f args)Internal. Use async-call instead.
Internal. Use async-call instead.
(create-async-caller dispatch-fn
{:keys [timeout-ms max-retries args-validator
result-validator]
:or {max-retries 0}})Creates an AsyncCaller backed by dispatch-fn.
dispatch-fn: (fn [f & args]) -> core.async channel with result or error
opts: :timeout-ms ms to wait for dispatch result (required) :max-retries max retry attempts on transport error or timeout (default 0) :args-validator (fn [args]) called before dispatch; throws to abort (optional) :result-validator (fn [result]) called on success; throws to abort (optional)
Retries on transport errors and timeouts only. Validator failures are not retried. Note: on timeout, the dispatch channel is abandoned (not closed). The dispatch go-block may still complete — its result will be GC'd.
Creates an AsyncCaller backed by dispatch-fn. dispatch-fn: (fn [f & args]) -> core.async channel with result or error opts: :timeout-ms ms to wait for dispatch result (required) :max-retries max retry attempts on transport error or timeout (default 0) :args-validator (fn [args]) called before dispatch; throws to abort (optional) :result-validator (fn [result]) called on success; throws to abort (optional) Retries on transport errors and timeouts only. Validator failures are not retried. Note: on timeout, the dispatch channel is abandoned (not closed). The dispatch go-block may still complete — its result will be GC'd.
(error? x)(failing-always handler)Wraps handler so that every call returns an injected error value instead of delegating to handler. Use to stress-test behavior under persistent failure.
Wraps handler so that every call returns an injected error value instead of delegating to handler. Use to stress-test behavior under persistent failure.
(failing-randomly n handler)Wraps handler so that exactly one call per n-call window returns an injected error value instead of delegating to handler. The window always runs for exactly n calls; the single failing call within it is chosen at random. After n calls, a new fail position is chosen for the next window.
The returned fn returns an ex-info instance (not throws) on the failing call, matching the error-as-value convention expected by dispatch-fns used with create-async-caller.
Not thread-safe; intended for single-threaded test harnesses.
Wraps handler so that exactly one call per n-call window returns an injected error value instead of delegating to handler. The window always runs for exactly n calls; the single failing call within it is chosen at random. After n calls, a new fail position is chosen for the next window. The returned fn returns an ex-info instance (not throws) on the failing call, matching the error-as-value convention expected by dispatch-fns used with create-async-caller. Not thread-safe; intended for single-threaded test harnesses.
(handler [request] & body)(std-json-handler status decoder logic encoder)cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |