Entry-point into the LambdaCD event bus.
The event-bus exists to decouple communication between various parts of LambdaCD and allow external libraries to act on or publish events in a LambdaCD instance.
Usage example:
(let [subscription (subscribe ctx :some-topic)
payloads (only-payload subscription)]
(<! (go-loop []
(if-let [event (<! payloads)]
(do
(publish! ctx :some-other-topic (:some-value event))
(recur)))))
(unsubscribe ctx :some-topic subscription))
Entry-point into the LambdaCD event bus.
The event-bus exists to decouple communication between various parts of LambdaCD and
allow external libraries to act on or publish events in a LambdaCD instance.
Usage example:
```clojure
(let [subscription (subscribe ctx :some-topic)
payloads (only-payload subscription)]
(<! (go-loop []
(if-let [event (<! payloads)]
(do
(publish! ctx :some-other-topic (:some-value event))
(recur)))))
(unsubscribe ctx :some-topic subscription))
```(initialize-event-bus ctx)Initialize everything necessary for an event-bus to run. Returns a ctx that contains everything necessary so others can use the event-bus later on.
Initialize everything necessary for an event-bus to run. Returns a ctx that contains everything necessary so others can use the event-bus later on.
(only-payload subscription)Takes a subscription channel and returns a channel that contains only the payload.
Takes a subscription channel and returns a channel that contains only the payload.
(publish! ctx topic payload)Publish an event on a particular topic of the event-bus when calling from a go block.
Publish an event on a particular topic of the event-bus when calling from a go block.
(publish!! ctx topic payload)Publish an event on a particular topic of the event-bus when calling from a normal thread.
Publish an event on a particular topic of the event-bus when calling from a normal thread.
(subscribe ctx topic)Subscribe to a particular topic on the event-bus. Returns a subscription channel, i.e. a channel of events and metadata. Use only-payload to get a channel of only event payloads.
Subscribe to a particular topic on the event-bus. Returns a subscription channel, i.e. a channel of events and metadata. Use only-payload to get a channel of only event payloads.
(unsubscribe ctx topic subscription)Unsubscribe from a channel. Receives the topic we want to unsubscribe from and the subscription channel returned by subscribe.
Unsubscribe from a channel. Receives the topic we want to unsubscribe from and the subscription channel returned by subscribe.
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 |