Liking cljdoc? Tell your friends :D

wagoe.realtime.shell.bus.redis

Redis-backed IMessageBus: routing envelopes travel as Nippy-frozen bytes over a binary Redis pub/sub channel. publish borrows a pooled connection; the subscriber owns ONE dedicated connection (not from the publish pool, so a blocking SUBSCRIBE never starves publishers) on a daemon thread.

Concurrency:

  • Singleton subscriber: start-subscriber! is idempotent (running? guard) so a node never holds two channel subscriptions (which would double-deliver).
  • Reconnect: the daemon loops with backoff, acquiring the connection INSIDE the loop so a Redis outage at startup retries instead of killing the daemon and leaving the node permanently deaf. Gap messages are missed (at-most-once, accepted).

Trust boundary: onMessage thaws Nippy bytes off the channel. Envelopes are produced only by this framework's own publishers on a trusted Redis instance. Do NOT point this at a Redis shared with untrusted writers — Nippy thaw of attacker-controlled bytes is a deserialization risk.

Redis-backed IMessageBus: routing envelopes travel as Nippy-frozen bytes over
a binary Redis pub/sub channel. publish borrows a pooled connection; the
subscriber owns ONE dedicated connection (not from the publish pool, so a
blocking SUBSCRIBE never starves publishers) on a daemon thread.

Concurrency:
- Singleton subscriber: start-subscriber! is idempotent (running? guard) so a
  node never holds two channel subscriptions (which would double-deliver).
- Reconnect: the daemon loops with backoff, acquiring the connection INSIDE
  the loop so a Redis outage at startup retries instead of killing the daemon
  and leaving the node permanently deaf. Gap messages are missed
  (at-most-once, accepted).

Trust boundary: onMessage thaws Nippy bytes off the channel. Envelopes are
produced only by this framework's own publishers on a trusted Redis instance.
Do NOT point this at a Redis shared with untrusted writers — Nippy thaw of
attacker-controlled bytes is a deserialization risk.
raw docstring

create-poolclj

(create-pool {:keys [host port password database timeout max-total max-idle
                     min-idle]})

Build a JedisPool from a config map. Supports auth, database selection, socket timeout, and pool sizing (mirrors the cache Redis adapter).

Config keys (all optional): :host :port :password :database :timeout :max-total :max-idle :min-idle

Build a JedisPool from a config map. Supports auth, database selection,
socket timeout, and pool sizing (mirrors the cache Redis adapter).

Config keys (all optional):
  :host :port :password :database :timeout
  :max-total :max-idle :min-idle
sourceraw docstring

create-redis-busclj

(create-redis-bus {:keys [channel subscribe-timeout-ms] :as config})

Create a Redis message bus.

Config keys (all optional unless noted): :host :port - Redis location (default localhost:6379) :password :database - auth + db selection (production) :timeout - socket timeout ms (default 2000) :max-total :max-idle :min-idle - publish-pool sizing :channel - pub/sub channel (default "wagoe:realtime:bus") :subscribe-timeout-ms - how long start-subscriber! waits for the subscription to go live before returning and leaving the background loop to keep retrying (default 5000)

Create a Redis message bus.

Config keys (all optional unless noted):
  :host :port           - Redis location (default localhost:6379)
  :password :database   - auth + db selection (production)
  :timeout              - socket timeout ms (default 2000)
  :max-total :max-idle :min-idle - publish-pool sizing
  :channel              - pub/sub channel (default "wagoe:realtime:bus")
  :subscribe-timeout-ms - how long start-subscriber! waits for the
                          subscription to go live before returning and
                          leaving the background loop to keep retrying
                          (default 5000)
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close