Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make langohr.consumers/subscribe support old and new style options

Fixes #13
  • Loading branch information...
commit d623de50436ac92b5abb1f0ca926dc12928446b6 1 parent 8802c62
Michael Klishin authored
Showing with 30 additions and 5 deletions.
  1. +20 −0 ChangeLog.md
  2. +10 −5 src/clojure/langohr/consumers.clj
View
20 ChangeLog.md
@@ -1,3 +1,23 @@
+## Changes between Langohr 1.0.0-beta12 and 1.0.0-beta13
+
+`1.0.0-beta13` has **BREAKING CHANGES**:
+
+### langohr.consumers/subscribe Options Renamed
+
+The options `langohr.consumers/subscribe` takes now have consistent naming:
+
+ * `:consume-ok-fn` becomes `:handle-consume-ok-fn`
+ * `:cancel-fn` becomes `:handle-cancel-fn`
+ * `:cancel-ok-fn` becomes `:handle-cancel-ok-fn`
+ * `:shutdown-signal-ok-fn` becomes `:handle-shutdown-signal-ok-fn`
+ * `:recover-ok-fn` becomes `:handle-recover-ok-fn`
+ * `:handle-delivery-fn` does not change
+
+This makes handler argument names consistent across the board.
+
+Previous options (`:handle-cancel`, etc) are still supported
+for backwards compatibility but will eventually be removed.
+
## Changes between Langohr 1.0.0-beta11 and 1.0.0-beta12
### Clojure-friendly Return Values
View
15 src/clojure/langohr/consumers.clj
@@ -61,9 +61,14 @@
options' (apply dissoc (concat [options] keys))
consumer (create-default channel
:handle-delivery-fn f
- :handle-consume-ok-fn (get cons-opts :handle-consume-ok)
- :handle-cancel-ok-fn (get cons-opts :handle-cancel-ok)
- :handle-cancel-fn (get cons-opts :handle-cancel)
- :handle-recover-ok-fn (get cons-opts :handle-recover-ok)
- :handle-shutdown-signal-fn (get cons-opts :handle-shutdown-signal))]
+ :handle-consume-ok-fn (or (get cons-opts :handle-consume-ok-fn)
+ (get cons-opts :handle-consume-ok))
+ :handle-cancel-ok-fn (or (get cons-opts :handle-cancel-ok-fn)
+ (get cons-opts :handle-cancel-ok))
+ :handle-cancel-fn (or (get cons-opts :handle-cancel-fn)
+ (get cons-opts :handle-cancel))
+ :handle-recover-ok-fn (or (get cons-opts :handle-recover-ok-fn)
+ (get cons-opts :handle-recover-ok))
+ :handle-shutdown-signal-fn (or (get cons-opts :handle-shutdown-signal-fn)
+ (get cons-opts :handle-shutdown-signal)))]
(apply lhb/consume channel queue consumer (flatten (vec options')))))
Please sign in to comment.
Something went wrong with that request. Please try again.