【问题标题】:How to start immutant message queue?如何启动不可变消息队列?
【发布时间】:2015-06-06 00:11:46
【问题描述】:

来自http://immutant.org/documentation/current/apidoc/guide-installation.html 的不变文档:

有了依赖关系,您只需调用 Immutant 来自应用主入口点的服务,由 :main 标识 输入你的project.clj

Immutant 的网络服务可以这样调用:

(ns my-app.handler
  ...
  (:require [immutant.web :as web])
  ... )

(def app ... )

(defn -main [& args]
  (web/run app))

(web/run app)immutant.messaging 的等价物是什么?

【问题讨论】:

    标签: clojure immutant


    【解决方案1】:

    这里是你的答案 开始排队

    (ns my-project.name
    (:require [immutant.messaging :as msg]))
    
    (defn call-fn
      [args]
      (let [fun (ns-resolve "namespace where fun defined" (symbol (first args)))
            params (rest args)]
        (if (seq params)
          (apply fun )
          (fun))))
    
    (msg/start "queue")
    (msg/respond "queue" (fn [args] (call-fn args)))
    

    调用队列只是说

    @(msg/request "queue" ["fun-name" params])
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-16
      • 2012-05-07
      相关资源
      最近更新 更多