tolitius / mount

managing Clojure and ClojureScript app state since (reset)
Eclipse Public License 1.0
1.22k stars 88 forks source link

mount and celtuce #111

Open cmal opened 4 years ago

cmal commented 4 years ago

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.

image

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.