I\'m trying to figure out the best way to use agents to consume items from a Message Queue (Amazon SQS). Right now I have a function (process-queue-item) that grabs an item
Not sure how idiomatic this is, as I'm still a newbie with the language, but the following solution works for me:
(let [number-of-messages-per-time 2
await-timeout 1000]
(doseq [p-messages (partition number-of-messages-per-time messages)]
(let [agents (map agent p-messages)]
(doseq [a agents] (send-off a process))
(apply await-for await-timeout agents)
(map deref agents))))