Skip to content

Instantly share code, notes, and snippets.

@creese

creese/elsewhere Secret

Created June 13, 2015 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save creese/82e095a0c9ea8a553c44 to your computer and use it in GitHub Desktop.
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
(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))
(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