Liking cljdoc? Tell your friends :D

everest.handler.middleware


wrap-positionclj

(wrap-position handler {:handler.middleware/keys [state-store]})

Updates the handler's position after the handler is done with the event.

Accepts the following options:

  • state-store - an instance of a IHandlerStateStore

Events must have a :handler/id attached to identify the handler.

Updates the handler's position after the handler is done with the event.

Accepts the following options:

  * `state-store` - an instance of a `IHandlerStateStore`

Events must have a `:handler/id` attached to identify the handler.
raw docstring

wrap-stateclj

(wrap-state handler
            {:handler.middleware/keys [state-key state-store
                                       catch-up-upsert-batch-size
                                       upsert-batch-size]
             :or {state-key :handler/state
                  catch-up-upsert-batch-size 1
                  upsert-batch-size 1}})

Updates the handler's state and position when the handler returns new state. If a handler skips the event (see handler/handled?), the state is not updated.

Accepts the following options:

  • state-store - an instance of a IHandlerStateStore. Has to return at least #:handler{:state any?, :position position?}.
  • state-key - :handler/state by default. The key under which the current state will be stored in the event map.
  • catch-up-upsert-batch-size - number of events to appear when catching up before state is updated
  • upsert-batch-size - number of events to appear when processing live before state is updated

This middleware doesn't automatically make the actions performed in the handler idempotent with respect to state and position tracking. You must ensure that yourself by attaching an event position or other identifier to the actions you perform in the handler.

Updates the handler's state and position when the handler returns new state.
If a handler skips the event (see `handler/handled?`), the state is not
updated.

Accepts the following options:

  * `state-store` - an instance of a `IHandlerStateStore`. Has to return at least
    `#:handler{:state any?, :position position?}`.
  * `state-key` - `:handler/state` by default. The key under which the current state
    will be stored in the event map.
  * `catch-up-upsert-batch-size` - number of events to appear when catching up before
    state is updated
  * `upsert-batch-size` - number of events to appear when processing live before
    state is updated

This middleware doesn't automatically make the actions performed in the
handler idempotent with respect to state and position tracking. You must
ensure that yourself by attaching an event position or other identifier to
the actions you perform in the handler.
raw docstring

wrap-state-atomclj

(wrap-state-atom handler
                 {:handler.middleware/keys [state-key]
                  :or {state-key :handler/state}})

Wraps the state under the state-key in an atom. Instead of returning the state you will have to swap! or reset! the atom.

Depends on the state present under the state-key (:handler/state by default).

Wraps the state under the `state-key` in an atom. Instead of returning the
state you will have to `swap!` or `reset!` the atom.

Depends on the state present under the `state-key` (`:handler/state` by
default).
raw docstring

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

× close