Permalink
Browse files

Make sure return listeners receive message body as is

  • Loading branch information...
1 parent 0f666be commit 4f7a3fe0758b9cbdd9e5ce5ea8fab23820774e09 @michaelklishin committed Sep 25, 2012
Showing with 20 additions and 4 deletions.
  1. +12 −0 ChangeLog.md
  2. +7 −3 src/clojure/langohr/basic.clj
  3. +1 −1 test/langohr/test/basic_test.clj
View
@@ -1,3 +1,15 @@
+## Changes between Langohr 1.0.0-beta8 and 1.0.0-beta9
+
+`1.0.0-beta9` has **BREAKING CHANGES**:
+
+### Return Handlers Body Now Passed as-is
+
+Langohr no longer instantiates a string from the message body before passing it to
+return listeners. The body will be passed as is, as an array of bytes.
+
+
+
+
## Changes between Langohr 1.0.0-beta7 and 1.0.0-beta8
`1.0.0-beta8` has **BREAKING CHANGES**:
@@ -97,12 +97,16 @@
(.addReturnListener channel listener))
"
- [^clojure.lang.IFn handler-fn]
+ [^clojure.lang.IFn f]
(reify ReturnListener
(handleReturn [this reply-code reply-text exchange routing-key properties body]
- (handler-fn reply-code reply-text exchange routing-key properties (String. ^bytes body)))))
-
+ (f reply-code reply-text exchange routing-key properties body))))
+(defn add-return-listener
+ "Adds return listener to the given channel"
+ [^Channel channel ^clojure.lang.IFn f]
+ (.addReturnListener channel (return-listener f))
+ channel)
@@ -265,7 +265,7 @@
queue (.getQueue (lhq/declare channel))
latch (java.util.concurrent.CountDownLatch. 1)
rl (lhb/return-listener (fn [reply-code, reply-text, exchange, routing-key, properties, body]
- (is (= body "return-me"))
+ (is (= (String. ^bytes body) "return-me"))
(.countDown latch)))]
(.addReturnListener channel rl)
(lhb/publish channel "" queue "return-me" :immediate true)

0 comments on commit 4f7a3fe

Please sign in to comment.