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.
(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 everything necessary for an event-bus to run. Returns a ctx that contains everything necessary so others can use the event-bus later on.
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!! ctx topic payload)
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.
(unsubscribe ctx topic subscription)
Unsubscribe from a channel. Receives the topic we want to unsubscribe from and the subscription channel returned by subscribe.