Skip to content

Instantly share code, notes, and snippets.

@gerritjvv
Created September 23, 2019 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gerritjvv/579473c11d113bbe4ebe0cbf9feed4db to your computer and use it in GitHub Desktop.
Save gerritjvv/579473c11d113bbe4ebe0cbf9feed4db to your computer and use it in GitHub Desktop.
clojure cognitect aws sqs
;; deps:
;; [com.cognitect.aws/api "0.8.352"]
;; [com.cognitect.aws/endpoints "1.1.11.632"]
;; [com.cognitect.aws/sqs "742.2.519.0"]
;; [mount "0.1.16"]
;; [cheshire "5.8.1"]
(require '[cognitect.aws.client.api :as aws])
(require '[mount.core :as mount)
(defn -create-sqs-client []
(let [api (aws/client {:api :sqs})]
api))
(mount/defstate AWS-SQS
:start (-create-sqs-client))
(defn send-msg! [sqs-url msg]
(let [msg-str (json/generate-string msg)]
(aws/invoke AWS-SQS {:op :SendMessage
:request {:QueueUrl sqs-url
:MessageBody msg-str}})))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment