Skip to content

Instantly share code, notes, and snippets.

@jcrossley3
Created October 15, 2011 01:34
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 jcrossley3/1288852 to your computer and use it in GitHub Desktop.
Save jcrossley3/1288852 to your computer and use it in GitHub Desktop.
(defn wait-for-destination [f & count]
(let [attempts (or count 30)
retry #((Thread/sleep 1000) (wait-for-destination f (dec attempts)))]
(try
(f)
(catch javax.naming.NameNotFoundException e
(if (> attempts 0) (retry) (throw e)))
(catch javax.jms.InvalidDestinationException e
(if (> attempts 0) (retry) (throw e)))
(catch javax.jms.JMSException e
(if (> attempts 0) (retry) (throw e))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment