mount
mount copied to clipboard
mount and celtuce
redis.clj:
(ns proj.redis
(:require
[celtuce.connector :as conn]
[taoensso.timbre :as log]
[mount.core :as mount]
[proj.global :as g]))
(mount/defstate redis-client
:start (let [port (get-in @g/config [:port :redis])
connector (conn/redis-server (str "redis://localhost:" port))]
(log/info (str "redis connection established on port: " port "."))
connector)
:stop (do
(conn/shutdown redis-client)
(log/info "redis connection closed.")))
(def cmds
(conn/commands-sync redis-client))
$ lein uberjar
java.lang.IllegalArgumentException: No implementation of method: :commands-sync of protocol: #'celtuce.connector/RedisConnector found for class: mount.core.DerefableState, compiling:(redis.clj:24:3) Exception in thread "main" java.lang.IllegalArgumentException: No implementation of method: :commands-sync of protocol: #'celtuce.connector/RedisConnector found for class: mount.core.DerefableState, compiling:(redis.clj:24:3)
It seems syntax checking not passed when compiling.

I also found redis-client is a celtuce.connector.RedisServer, and (def cmds (conn/commands-sync redis-client)) can be run in repl, but cannot be compiled.