This repository has been archived by the owner. It is now read-only.
Asynchronous Clojure/Clojurescript client for Amazon's SNS & SQS services
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
test/fink_nottle/test
.gitignore
.projectile
.travis.yml
LICENSE
README.md
project.clj
repl.clj

README.md

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.