Permalink
Browse files

Begin cleaning up old junk

  • Loading branch information...
1 parent 741fd22 commit ea8e2e0ed856df33b99790f4f51ac7ba3f42417c @michaelklishin michaelklishin committed Apr 9, 2012
Showing with 19 additions and 23 deletions.
  1. +1 −1 project.clj
  2. +6 −6 src/langohr/basic.clj
  3. +2 −2 src/langohr/channel.clj
  4. +10 −14 src/langohr/core.clj
View
@@ -5,7 +5,7 @@
:dependencies [[org.clojure/clojure "1.3.0"]
[com.rabbitmq/amqp-client "2.8.1"]]
:profiles {:dev { :dependencies [[org.clojure/tools.cli "0.2.1" :exclusions [org.clojure/clojure]]] }
- :1.4 { :dependencies [[org.clojure/clojure "1.4.0-beta5"]] }}
+ :1.4 { :dependencies [[org.clojure/clojure "1.4.0-beta6"]] }}
:url "https://github.com/michaelklishin/langohr"
:repositories {"sonatype" {:url
"http://oss.sonatype.org/content/repositories/releases",
View
@@ -118,8 +118,8 @@
^Boolean :no-local (default false) - flag set to true unless server local buffering is required.
"
- [^Channel channel, ^String queue, ^Consumer consumer, &{ :keys [consumer-tag auto-ack exclusive arguments no-local]
- :or { consumer-tag "", auto-ack false, exclusive false, no-local false } }]
+ [^Channel channel ^String queue ^Consumer consumer &{ :keys [consumer-tag auto-ack exclusive arguments no-local]
+ :or { consumer-tag "" auto-ack false exclusive false no-local false } }]
(.basicConsume ^Channel channel ^String queue ^Boolean auto-ack ^String consumer-tag ^Boolean no-local ^Boolean exclusive ^Map arguments ^Consumer consumer))
@@ -131,9 +131,9 @@
(defn ^GetResponse get
"Fetches a message from a queue using basic.get AMQP method"
- ([^Channel channel, ^String queue]
+ ([^Channel channel ^String queue]
(.basicGet channel queue true))
- ([^Channel channel, ^String queue, ^Boolean auto-ack]
+ ([^Channel channel ^String queue ^Boolean auto-ack]
(.basicGet channel queue auto-ack)))
@@ -171,9 +171,9 @@
"Notifies RabbitMQ that it needs to redeliver unacknowledged messages using basic.recover AMQP method"
([^Channel channel]
(.basicRecover channel))
- ([^Channel channel, ^Boolean requeue]
+ ([^Channel channel ^Boolean requeue]
(.basicRecover channel requeue)))
(defn recover-async
- [^Channel channel, ^Boolean requeue]
+ [^Channel channel ^Boolean requeue]
(.basicRecoverAsync channel requeue))
View
@@ -25,8 +25,8 @@
"Closes given channel using channel.close AMQP method"
([^Channel channel]
(.close channel))
- ([^Channel channel, ^long code, ^String message]
- (.close channel, code, message)))
+ ([^Channel channel ^long code ^String message]
+ (.close channel code message)))
(defn open?
View
@@ -31,9 +31,8 @@
(extend-protocol Closeable
com.rabbitmq.client.Connection
- (close [this] (.close this)))
+ (close [this] (.close this))
-(extend-protocol Closeable
com.rabbitmq.client.Channel
(close [this] (.close this)))
@@ -43,9 +42,8 @@
(extend-protocol Openable
com.rabbitmq.client.Connection
- (open? [this] (.isOpen this)))
+ (open? [this] (.isOpen this))
-(extend-protocol Openable
com.rabbitmq.client.Channel
(open? [this] (.isOpen this)))
@@ -59,12 +57,10 @@
"Creates and returns a new connection to RabbitMQ."
;; defaults
([]
- (let [conn-factory (ConnectionFactory.)]
- (.newConnection conn-factory)))
+ (.newConnection (ConnectionFactory.)))
;; settings
([settings]
- (let [^ConnectionFactory conn-factory (create-connection-factory settings)]
- (.newConnection conn-factory))))
+ (.newConnection ^ConnectionFactory (create-connection-factory settings))))
(defn ^Channel create-channel
@@ -75,10 +71,10 @@
(defn shutdown-listener
"Adds new shutdown signal listener that delegates to given function"
- [^clojure.lang.IFn handler-fn]
+ [^clojure.lang.IFn f]
(reify ShutdownListener
(shutdownCompleted [this cause]
- (handler-fn cause))))
+ (f cause))))
;;
@@ -105,10 +101,10 @@
(defn- ^ConnectionFactory create-connection-factory
"Creates connection factory from given attributes"
[config]
- (let [{:keys [host port username password vhost requested-heartbeat connection-timeout] :or {
- requested-heartbeat ConnectionFactory/DEFAULT_HEARTBEAT
- connection-timeout ConnectionFactory/DEFAULT_CONNECTION_TIMEOUT
- } } (get-config config)]
+ (let [{:keys [host port username password vhost
+ requested-heartbeat connection-timeout]
+ :or {requested-heartbeat ConnectionFactory/DEFAULT_HEARTBEAT
+ connection-timeout ConnectionFactory/DEFAULT_CONNECTION_TIMEOUT} } (get-config config)]
(doto (ConnectionFactory.)
(.setUsername username)
(.setPassword password)

0 comments on commit ea8e2e0

Please sign in to comment.