【问题标题】:How can I use clj-http in riemann.config如何在 riemann.config 中使用 clj-http
【发布时间】:2015-07-01 06:02:31
【问题描述】:

我使用 riemann,现在我写我的 riemann.config

我想使用clj-http 将所有事件从 riemann 流发布到我的网络服务器。但我不知道如何从 riemann.jar 导入clj-http

我在riemann.config 中编码(:use clj-http.client)(:require [clj-http.client :as client]) 但出现错误:

java.lang.ClassNotFoundException: clj-http.client

谁能帮帮我?

【问题讨论】:

标签: clojure riemann


【解决方案1】:

几个月前我做了类似的事情,这对我有用。我正在使用 http-kit :

(require '[org.httpkit.client :as http])

由于 riemann 中提供了 http-kit 和 cli-http(请参阅 https://github.com/aphyr/riemann/blob/master/project.clj),您应该能够以相同的方式要求 cli-http:

(require '[clj-http.client :as client])

您的配置中的问题是您正在使用 (:use ... an (:require .... 应该在命名空间声明中使用。由于 riemann.config 不包含命名空间声明,您可以不要使用这些形式。调用时

(:use clj-http.client)

你得到 ClassNotFoundException 因为 clojure 试图调用函数 :use on clj-http.client ,但找不到。在命名空间声明之外 :use 只是一个没有特殊含义的标准关键字。

【讨论】:

    猜你喜欢
    • 2016-12-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多