Skip to content

Instantly share code, notes, and snippets.

@travis
Created November 15, 2012 12:38
Show Gist options
  • Select an option

  • Save travis/4078438 to your computer and use it in GitHub Desktop.

Select an option

Save travis/4078438 to your computer and use it in GitHub Desktop.
(defspout resque-spout ["action"]
[conf context collector]
(let [pool (redis/redis (:resque (config/redis-config)))]
(spout
(nextTuple []
(when-let [string (get-action redis)]
(when-let [action (action-from-resque string)]
(let [id (str (java.util.UUID/randomUUID))]
(emit-spout! collector [action] :id id)))))
(ack [id]
(log/info "finished processing action " id)
(acknowledge-success! id))
(fail [id]
(log/info "failed to process action " id)
(handle-failure! id)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment