-
-
Save creese/82e095a0c9ea8a553c44 to your computer and use it in GitHub Desktop.
Give 'handler a type and use that to create a consumer for the appropriate exchange in rabbitmq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defrecord InQueue [rabbitmq handler queue-names routing-keys] | |
component/Lifecycle | |
(start [this] | |
(println ";; Starting OutQueue") | |
(let [{:keys [connection]} rabbitmq | |
[type* handler-fn] handler | |
queue-name (->> queue-names | |
(filter #(= (first %) type*)) | |
(first)) | |
binding-queue (str (:ns (meta handler-fn)))] | |
(que connection queue-name routing-keys binding-queue))) | |
(stop [this] | |
nil)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def type* | |
:command) | |
(defhandler handler | |
[type* process-command]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment