An event bus inside one process.
For development, for tests, and for an application that has modules but not yet servers. It implements the same protocols as the Redis adapter so that moving between them is configuration — but it is not a smaller version of it: events do not leave the process, and history dies with it.
Delivery is asynchronous here even though it need not be. A bus that
delivers on the publisher's thread lets a caller depend on the handler
having finished by the time publish! returns, and that assumption then
fails silently against Redis. Matching the weaker guarantee is what makes
the adapters interchangeable.
An event bus inside one process. For development, for tests, and for an application that has modules but not yet servers. It implements the same protocols as the Redis adapter so that moving between them is configuration — but it is not a smaller version of it: events do not leave the process, and history dies with it. Delivery is asynchronous here even though it need not be. A bus that delivers on the publisher's thread lets a caller depend on the handler having finished by the time `publish!` returns, and that assumption then fails silently against Redis. Matching the weaker guarantee is what makes the adapters interchangeable.
(create-in-memory-bus & [{:keys [history-limit error-reporter]}])An event bus confined to this process.
opts may carry :history-limit (default 1000) and :error-reporter.
An event bus confined to this process. `opts` may carry `:history-limit` (default 1000) and `:error-reporter`.
(drain! {:keys [state executor]} topic)Wait until every accepted event has reached its subscribers, then return
what was published to topic since the last drain, oldest first. For tests,
where asynchronous delivery makes an assertion a race (BOU-469). An event a
handler publishes while being waited for is waited for too.
Wait until every accepted event has reached its subscribers, then return what was published to `topic` since the last drain, oldest first. For tests, where asynchronous delivery makes an assertion a race (BOU-469). An event a handler publishes while being waited for is waited for too.
(stop! {:keys [executor]})Stop delivering and release the thread.
Waits briefly for events already accepted: dropping them on shutdown would make a clean stop lossier than a crash, which is the wrong way round.
Stop delivering and release the thread. Waits briefly for events already accepted: dropping them on shutdown would make a clean stop lossier than a crash, which is the wrong way round.
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 |