manifold.bus

An implementation of an event bus, where publishers and subscribers can interact via topics.

active?

(active? bus topic)

Returns true if there are any subscribers to topic.

downstream

(downstream bus topic)

Returns a list of all streams subscribed to topic.

event-bus

(event-bus)(event-bus stream-generator)

Returns an event bus that can be used with publish! and subscribe.

publish!

(publish! bus topic message)

Publishes a message on the bus, returning a deferred result representing the message being accepted by all subscribers. To prevent one slow consumer from blocking all the others, use manifold.stream/buffer, or manifold.stream/connect with a timeout specified.

subscribe

(subscribe bus topic)

Returns a stream which consumes all messages from topic.

topic->subscribers

(topic->subscribers bus)