Permalink
Browse files

URL parsing isn't necessary; it's done in the rabbitmq adapter.

  • Loading branch information...
1 parent 6ac3048 commit 0afb52b024ba35a8eda85139a4e85b1abb0606b0 @technomancy committed May 23, 2012
Showing with 1 addition and 20 deletions.
  1. +1 −11 src/die/roboter.clj
  2. +0 −9 test/die/test/roboter.clj
View
@@ -6,7 +6,6 @@
[clojure.java.io :as io]
[clojure.walk :as walk])
(:import (java.util UUID)
- (java.net URI)
(java.util.concurrent Executors TimeUnit TimeoutException)
(java.lang.management ManagementFactory)
(java.io FilterInputStream ObjectInputStream ObjectOutputStream
@@ -48,20 +47,12 @@
(def ^{:dynamic true} *config* nil)
-(defn ^{:internal true} parse-url [{url :url :as config}]
- (if-let [{:keys [host userInfo path port]} (and url (bean (URI. url)))]
- (let [[user pass] (.split userInfo ":")
- port (if (pos? port) port (:port config))]
- (assoc config :username user :password pass
- :host host :port port :vhost path))
- config))
-
(defmacro with-robots [config & body]
;; :implicit should only start a new connection if there's none active.
`(if (or (and *config* (:implicit ~config))
(= *config* ~config)) ; avoid redundant nesting
(do ~@body)
- (binding [*config* (parse-url ~config)]
+ (binding [*config* ~config]
(wabbit/with-broker ~config
(wabbit/with-channel ~config
(init ~config)
@@ -194,7 +185,6 @@
(defn -main [& {:as opts}]
(let [opts (into {:workers (or (System/getenv "WORKER_COUNT") 4)
- :url (System/getenv "RABBITMQ_URL")
:log-level (or (System/getenv "LOG_LEVEL") "info")}
(walk/keywordize-keys opts))]
(println "Starting" (:workers opts) "workers.")
@@ -8,9 +8,6 @@
(:import (java.util.concurrent TimeUnit TimeoutException ExecutionException)
(java.io IOException)))
-(.setLevel (java.util.logging.Logger/getLogger "die.roboter")
- java.util.logging.Level/ALL) ; TODO: no-op
-
(def ^{:dynamic true} *timeout-expected* false)
(def state (atom {}))
@@ -131,9 +128,3 @@
(catch ExecutionException e
e)))
(finally (future-cancel worker)))))
-
-(deftest test-parse-uri
- (is (= {:vhost "/vhost", :port 12,
- :host "cloud.com", :password "pass", :username "user",}
- (dissoc (parse-uri {:uri "amqp://user:pass@cloud.com:12/vhost"})
- :uri))))

0 comments on commit 0afb52b

Please sign in to comment.