This is the listener, which is in redis.clj:
(defmethod ig/init-key :com.app.graphql.redis/chatroom-listener [_ connection]
;(timbre/warn "Connecting to the Redis server" opts)
(defmacro wcar* [& body] `(redis/wcar connection ~@body))
(let [listener
(redis/with-new-pubsub-listener (:spec connection)
{"one" (fn f1 [msg] (println "Channel match: " msg))}
(redis/subscribe "chatroom"))]
(try
(timbre/warn "Connected to the Redis - " (wcar* connection (redis/ping)))
;; Return the redis connection object
listener
;; When redis is not available then retrun nil
(catch Exception _
(timbre/warn "Unbale to connect with the Redis server ")
nil))))
Now to publish anything to the channel “one” we use:
(wcar* (car/publish "one" "Hello world"))
But I’m using this publish statement in other file… that’s why I’m getting this error. How to use it in another file?