Could you take a look at this:
For Listener this is the code example given in the docs:
(def listener
(car/with-new-pubsub-listener (:spec server1-conn)
{"foobar" (fn f1 [msg] (println "Channel match: " msg))
"foo*" (fn f2 [msg] (println "Pattern match: " msg))}
(car/subscribe "foobar" "foobaz")
(car/psubscribe "foo*")))
Now if the server1-conn is the connection, which we’ve declared via integrant in a separate file like this:
(defmethod ig/init-key :app/redis [_ {:keys [redis-host
redis-port] :as opts}]
(timbre/warn "Connecting to the Redis server" opts)
(let [conn {:pool {}
:spec {:host redis-host
:port redis-port}}]
(try
(timbre/warn "Connected to the Redis - " (redis/wcar conn (redis/ping)))
;; Return the redis connection object
conn
;; When redis is not available then retrun nil
(catch Exception _
(timbre/warn "Unbale to connect with the Redis server ")
nil))))
Now how to manage the conn with the listener? Thank you.