Skip to content

Instantly share code, notes, and snippets.

@raek

raek/horror.clj Secret

Forked from KirinDave/horror.clj
Created August 2, 2012 17:35
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 raek/fd7c827a7502f9222d1f to your computer and use it in GitHub Desktop.
Save raek/fd7c827a7502f9222d1f to your computer and use it in GitHub Desktop.
Ugh
(defmacro single-key-aggregate-writer [name update-builder table]
`(defbolt ~name [] [tuple# collector#]
(let [count-maps# (tfield "count-maps")]
(try
(doseq [[agg-id# count-map#] count-maps#]
(let [update-map# (~update-builder count-map#)]
(dynamodb/update-item base/aws-credential ~table agg-id# update-map#)))
(ack! collector# tuple#)
(catch Exception e#
(log/error (str "Exception commiting to " table#) (seq (.getStackTrace e#)))
(log/error e#)
(fail! collector# tuple#))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment