Asynchronous Clojure/Clojurescript client for Amazon's SQS & SNS services
The API introduction on the wiki is a good place to start.
(require '[fink-nottle.sqs.tagged :as sqs.tagged]
'[fink-nottle.sqs.channeled :as sqs.channeled])
(defmethod sqs.tagged/message-in :edn [_ body]
(clojure.edn/read-string body))
(defmethod sqs.tagged/message-out :edn [_ body] (pr-str body))
(defn send-loop! [creds queue-url]
(let [{:keys [in-chan]}
(sqs.channeled/batching-sends creds queue-url)]
(go
(loop [i 0]
(>! in-chan {:body {:event :increment :value i}
:fink-nottle/tag :edn})
(<! (async/timeout (rand-int 300)))
(recur (inc i))))))
(defn receive-loop! [id creds queue-url]
(let [messages (sqs.channeled/receive! creds queue-url)
{deletes :in-chan} (sqs.channeled/batching-deletes creds queue-url)]
(async/pipe messages deletes)))
All of the functionality (barring the synchronous convenience functions, and sns.consume) is exposed via Clojurescript. The implementation specifically targets Node, and uses lein-npm for declaring its dependency on bignumber.js.
The use-case I had in mind for Node support is writing AWS Lambda functions in Clojurescript.
See the Eulalie README for other Node-relevant details.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close