Skip to content
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...
1 parent 7eaf4f0 commit 0ef9186e62664e9f91dbb9a64a1b6d4363075db9 Sun Ning committed
Showing with 7 additions and 13 deletions.
  1. +7 −13 src/metaq/core.clj
View
20 src/metaq/core.clj
@@ -38,14 +38,11 @@
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]
@@ -53,11 +50,7 @@
(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.
Something went wrong with that request. Please try again.