0

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

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

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

java.lang.ClassNotFoundException: clj-http.client

谁能帮助我?

4

1 回答 1

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 只是一个没有特殊含义的标准关键字。

于 2015-07-01T07:39:46.463 回答