Permalink
Browse files

return producer or consumer in void function to enable chained invoca…

…tions
  • Loading branch information...
1 parent 94a1403 commit 7eaf4f03db82a419c6cead7de3921372d44693a1 Sun Ning committed Aug 23, 2012
Showing with 8 additions and 4 deletions.
  1. +8 −4 src/metaq/core.clj
View
@@ -34,7 +34,8 @@
producer))
(defn publish [^MessageProducer producer topic]
- (.publish producer topic))
+ (.publish producer topic)
+ producer)
(defn produce [^MessageProducer producer topic data]
(try
@@ -44,7 +45,8 @@
(logging/warn "Error publishing to MQ: " (.getErrorMessage r))))
(catch MetaClientException e
(do
- (logging/warn e "Error publishing to MQ.")))))
+ (logging/warn e "Error publishing to MQ."))))
+ producer)
(defmacro defhandler [name executor arg-vec & handler-body]
`(def ~name
@@ -70,7 +72,9 @@
consumer))
(defn subscribe [consumer topic handler]
- (.subscribe consumer topic (* 1024 1024) handler))
+ (.subscribe consumer topic (* 1024 1024) handler)
+ consumer)
(defn subscribe-done [consumer]
- (.completeSubscribe consumer))
+ (.completeSubscribe consumer)
+ consumer)

0 comments on commit 7eaf4f0

Please sign in to comment.