Skip to content

Instantly share code, notes, and snippets.

@lukaszkorecki
Last active October 27, 2015 17:26
Show Gist options
  • Save lukaszkorecki/0a4b46d3c4897f007862 to your computer and use it in GitHub Desktop.
Save lukaszkorecki/0a4b46d3c4897f007862 to your computer and use it in GitHub Desktop.
Work-in-progress wrapper around langohr - Clojure RabbitMQ client library
(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