Last active
October 27, 2015 17:26
-
-
Save lukaszkorecki/0a4b46d3c4897f007862 to your computer and use it in GitHub Desktop.
Work-in-progress wrapper around langohr - Clojure RabbitMQ client library
This file contains hidden or 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
| (ns something.core | |
| (:require [something.message-bus :as message-bus])) | |
| ; handler simply gets a hashmap, from the JSON payload | |
| ; Responses are modeled after jondot/sneakers | |
| ; :ack - acks | |
| ; :reject - rejects message, it will be retiried | |
| ; :reject-requeue - rejects and requeues straight away (dangerous!) | |
| (defn handler-fn [payload] | |
| (let [m (:m payload)] | |
| (if | |
| (= m 6) | |
| { :status :ack } | |
| { :status :reject }))) | |
| (defn -main [] | |
| (message-bus/start handler-fn | |
| { :queue-name "some.queue" | |
| :message-ttl 60000 | |
| :max-retries 5})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment