replaced http-kit with clj-http

This commit is contained in:
Guillaume Buisson 2015-03-11 11:35:19 +01:00
parent 860eed1912
commit 2c08718a52
3 changed files with 6 additions and 10 deletions

View file

@ -1,4 +1,4 @@
(defproject y42/clj-druid "0.1.6-SNAPSHOT"
(defproject y42/clj-druid "0.1.7-SNAPSHOT"
:description "Clojure library for Druid.io"
:url "http://github.com/y42/clj-druid"
:license {:name "MIT"
@ -7,7 +7,7 @@
:dependencies [[org.clojure/clojure "1.6.0"]
[org.clojure/core.async "0.1.346.0-17112a-alpha"]
[swiss-arrows "1.0.0"]
[http-kit "2.1.18"]
[clj-http "1.0.1"]
[prismatic/schema "0.3.3"]
[org.clojure/tools.logging "0.3.0"]
[org.clojure/data.json "0.2.5"]

View file

@ -5,7 +5,7 @@
[clj-druid.schemas :as sch]
[clj-druid.validations :as v]
[swiss.arrows :refer :all]
[org.httpkit.client :as http]
[clj-http.client :as http]
[clojure.core.async :refer [put! chan <! <!! >! >!! go timeout close!]]))
@ -98,12 +98,11 @@
(from-user (:hosts params)))
(defn async-query
(defn query
"Issue a druid query using http-kit client in async mode"
[balance-strategy query-type druid-query & params]
(let [params (apply hash-map params)
channel (chan 1000)
options (-<> (into druid-query {:queryType query-type})
(v/validate query-type)
@ -111,7 +110,4 @@
{:body <> :as :text}
(merge params))]
(http/post (balance-strategy) options #(go (do (>! channel %)
(close! channel))))
channel))
(http/post (balance-strategy) options)))

View file

@ -26,4 +26,4 @@
(connect {:hosts ["http://127.0.0.1:8083/druid/v2/"]})
(async-query randomized :groupBy f/valid-groupby-query :timeout 5000))
(query randomized :groupBy f/valid-groupby-query :timeout 5000))