Created
September 23, 2019 13:03
-
-
Save gerritjvv/579473c11d113bbe4ebe0cbf9feed4db to your computer and use it in GitHub Desktop.
clojure cognitect aws sqs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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