Created
February 17, 2010 21:07
-
-
Save filiptepper/307007 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def dispatch!(connection, clazz) | |
n = 0 | |
for queue in @routing.queue_names_routing_class(clazz) | |
begin | |
result = connection.retrieve(queue) | |
if result | |
n += 1 | |
handler = @routing[queue] | |
method_name = @routing.method_name(queue) | |
logger.debug("Calling #{handler.class.to_s}\##{method_name}(#{result.inspect})") | |
handler.dispatch_to_worker_method(method_name, result) | |
end | |
rescue MemCache::MemCacheError => e | |
logger.error("FAILED to connect with queue #{ queue }: #{ e } }") | |
raise e | |
rescue => e | |
logger.error("FAILED to connect with queue #{ queue }: #{ e } }") | |
raise e | |
end | |
end | |
return n | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment