Holds the connection used by the pg.store, wrap-connection
middleware and other everest.jdbc functionality in order to provide
transactions spanning the whole handler chain.
Holds the connection used by the pg.store, `wrap-connection` middleware and other everest.jdbc functionality in order to provide transactions spanning the whole handler chain.
(with-unbound-connection & forms)Use this when you inherit the bindings of a thread that has the
*connection* bound.
For example, suppose we have an event handler with PG Connection middleware
which spawns a future and calls IEventStore functions inside. The
*connection* binding will be copied into the thread running the Future.
However, the connection itself will probably already be closed as the event
handler execution is done.
(def handler (-> (fn [_] (future (dynamic/with-unbound-connection (store/read-stream-forward ...)))) (wrap-connection {:handler.middleware/db ...})))
Use this when you inherit the bindings of a thread that has the
`*connection*` bound.
For example, suppose we have an event handler with PG Connection middleware
which spawns a `future` and calls `IEventStore` functions inside. The
`*connection*` binding will be copied into the thread running the Future.
However, the connection itself will probably already be closed as the event
handler execution is done.
(def handler
(-> (fn [_]
(future
(dynamic/with-unbound-connection
(store/read-stream-forward ...))))
(wrap-connection {:handler.middleware/db ...})))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 |