-
-
Save lukaszkorecki/4ddede30578bcdd00f043be861ba568f to your computer and use it in GitHub Desktop.
This file contains 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
(defn unwrap-payload | |
[input] | |
(let [raw (json/parse-string (slurp input) true) | |
;; actuall notification data is wrapped in an inner json field | |
payload (-> raw :Records first :Sns :Message (json/parse-string true))] | |
payload)) | |
(gen-class | |
:name "something.Core" | |
:implements [com.amazonaws.services.lambda.runtime.RequestStreamHandler]) | |
(defn -handleRequest | |
[_this input output ctx] | |
(let [logger (.getLogger ctx) | |
payload (unwrap-payload input) | |
res (do-something-with-payload logger payload)] | |
(with-open [o (io/writer output)] | |
(.write o (json/generate-string {:message "ack", :result res}))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment