Created
October 15, 2011 01:34
-
-
Save jcrossley3/1288852 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 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