Permalink
Browse files

do not catch any exception in the library. leave it to user. also met…

…aq client supports retry for unhandled message, we should not override the error
  • Loading branch information...
Sun Ning
Sun Ning committed Sep 7, 2012
1 parent 7eaf4f0 commit 0ef9186e62664e9f91dbb9a64a1b6d4363075db9
Showing with 7 additions and 13 deletions.
  1. +7 −13 src/metaq/core.clj
View
@@ -38,26 +38,19 @@
producer)
(defn produce [^MessageProducer producer topic data]
- (try
- (let [r (.sendMessage producer (Message. topic data)
- (long 10) TimeUnit/SECONDS)]
- (when-not (.isSuccess r)
- (logging/warn "Error publishing to MQ: " (.getErrorMessage r))))
- (catch MetaClientException e
- (do
- (logging/warn e "Error publishing to MQ."))))
+
+ (let [r (.sendMessage producer (Message. topic data)
+ (long 10) TimeUnit/SECONDS)]
+ (when-not (.isSuccess r)
+ (logging/warn "Error publishing to MQ: " (.getErrorMessage r))))
producer)
(defmacro defhandler [name executor arg-vec & handler-body]
`(def ~name
(let [executor# ~executor]
(reify MessageListener
(^void recieveMessages [this# ^Message msg#]
- (try
- ((fn ~arg-vec ~@handler-body) (.getData msg#))
- (catch Exception e#
- (logging/warn e# "Error processing message: "
- (String. (.getData msg#) "UTF-8")))))
+ ((fn ~arg-vec ~@handler-body) (.getData msg#)))
(getExecutor [this]
executor#)))))
@@ -78,3 +71,4 @@
(defn subscribe-done [consumer]
(.completeSubscribe consumer)
consumer)
+

0 comments on commit 0ef9186

Please sign in to comment.