-
async-blocker-interceptor [] [merge-data-fn]
Async blocker interceptor, the one mandatory to resolve async-channels created by `async-fetch-output-interceptor`
before jumping into the handlers. Optional merge-data-fn is the function used to merge different data returned by the interceptors.
The default fn is `merge`.
- merge-data-fn ^fn : optional merge function, when not sent, `merge` is used as default
- returns ^map context map
(async-blocker-interceptor)
(async-blocker-interceptor my-merge-fn)
-
async-fetch-output-interceptor [m]
Creates an async interceptor that receives a `{:name string? :enter fn? :leave fn?}` as param.
It creates a channel and adds it the context `:async-channels` map with interceptor `:name` as key.
The optional `:enter` function is triggered and the result is executed async and put to the channel while the queue goes on.
The optional `:leave` function is triggered async, but no result is stored anywhere
- m ^map : interceptor map `{:name string? :enter fn? :leave fn?}` one of enter or leave is mandatory, both are also accepted
- returns ^map context map
(async-fetch-output-interceptor {:name :async-i-name
:enter (fn [context]
;... my body sync or async to be paralellized
)})
-
async-output-interceptor [m]
Creates an async interceptor that receives a `{:name string? :enter fn?}` as param.
It executes the `:enter` and/or `:leave` function async and the queue goes on while it is executed by the async threads in parallel.
- m ^map : interceptor map `{:name string? :enter fn? :leave fn?}` one of enter or leave is mandatory, both are also accepted
- returns ^map context map
(async-output-interceptor {:name :async-i-name
:enter (fn [context]
;... my body sync or async to be parallelized
)})