(subscribe conn-spec channel listener-fn & [on-error])
Subscribes to a particular channel and returns a listener handle. To unsubscribe, keep a reference to the return val
Subscribes to a particular channel and returns a listener handle. To unsubscribe, keep a reference to the return val
(with-new-keepalive-listener conn-spec handler initial-state & body)
Extension of carmine/with-new-listener A health check added listener on top of the awesome carmine/with-new-listener macro. Use ping-ms in connection spec to override default 30000ms ping timeout. For fatal exceptions on the listener, add channel listener to pubsub:listener:fail For keep alive ping callbacks, add channel listener to pubsub:ping
Extension of carmine/with-new-listener A health check added listener on top of the awesome carmine/with-new-listener macro. Use ping-ms in connection spec to override default 30000ms ping timeout. For fatal exceptions on the listener, add channel listener to pubsub:listener:fail For keep alive ping callbacks, add channel listener to pubsub:ping
(with-new-keepalive-pubsub-listener conn-spec
message-handlers
&
subscription-commands)
A wrapper for with-new-keepalive-listener
. - Extension of carmine/with-new-pubsub-listener
Creates a persistent[1] connection to Redis server and a thread to
handle messages published to channels that you subscribe to with
subscribe
/psubscribe
calls in body, with a keep-alive
Handlers will receive messages of form: [<msg-type> <channel/pattern> <message-content>].
(with-new-keepalive-pubsub-listener
{} ; Connection spec, as per wcar
docstring [1]
{"channel1" (fn [[type match content :as msg]] (prn "Channel match: " msg))
"user*" (fn [[type match content :as msg]] (prn "Pattern match: " msg))}
(subscribe "foobar") ; Subscribe thread conn to "foobar" channel
(psubscribe "foo*") ; Subscribe thread conn to "foo*" channel pattern
)
Returns the Listener to allow manual closing and adjustments to message-handlers.
[1] You probably do NOT want a :timeout for your conn-spec
here.
A wrapper for `with-new-keepalive-listener`. - Extension of carmine/with-new-pubsub-listener Creates a persistent[1] connection to Redis server and a thread to handle messages published to channels that you subscribe to with `subscribe`/`psubscribe` calls in body, with a keep-alive Handlers will receive messages of form: [<msg-type> <channel/pattern> <message-content>]. (with-new-keepalive-pubsub-listener {} ; Connection spec, as per `wcar` docstring [1] {"channel1" (fn [[type match content :as msg]] (prn "Channel match: " msg)) "user*" (fn [[type match content :as msg]] (prn "Pattern match: " msg))} (subscribe "foobar") ; Subscribe thread conn to "foobar" channel (psubscribe "foo*") ; Subscribe thread conn to "foo*" channel pattern ) Returns the Listener to allow manual closing and adjustments to message-handlers. [1] You probably do *NOT* want a :timeout for your `conn-spec` here.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close