riemann.pubsub

Provides publish-subscribe handling of events. Publishers push events onto a channel, which has n subscribers. Each subscriber subscribes to a channel with an optional predicate function. Events which match the predicate are sent to the subscriber.

dissoc-in

(dissoc-in m [k & ks :as keys])

Dissociates an entry from a nested associative structure returning a new nested structure. keys is a sequence of keys. Any empty maps that result will not be present in the new structure.

last-sub-id

The most recently assigned subscription ID.

PubSub

protocol

The PubSub protocol defines the interface for publishing and subscribing to channels; essentially, sets of named callbacks.

members

publish!

(publish! this channel event)

Publish an event to a channel.

subscribe!

(subscribe! this channel f)(subscribe! this channel f persistent?)

Subscribes to the given channel. Returns a Subscription.

sweep!

(sweep! this)

Shuts down all non-persistent subscriptions. Used when reloading the pubsub system, and we want to clear any subscriptions from the old streams.

unsubscribe!

(unsubscribe! this sub)

Cancels a subscription.

pubsub-registry

(pubsub-registry)

Returns a new pubsub registry, which tracks which subscribers are listening to which channels.

sub-id

(sub-id)

Returns a new unique subscription ID.