Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

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

License

Notifications You must be signed in to change notification settings

nervous-systems/fink-nottle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •