Liking cljdoc? Tell your friends :D

fink-nottle Build Status

Clojars Project

Asynchronous Clojure/Clojurescript client for Amazon's SQS & SNS services

  • core.async-based API
  • Targets both Clojure and Clojurescript/Node
  • Flexible, uniform interface across SNS & SQS
  • Channel-based batching of outgoing messages

Documentation

The API introduction on the wiki is a good place to start.

Writing

Additional Functionality

  • Chard is a synchronous Clojure library atop Fink-Nottle. It simplifies the provisioning of sensibly-configured queues, and allows fuss-free transmission from SNS to SQS.

SQS Example

(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)))

Clojurescript

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