Skip to content

Instantly share code, notes, and snippets.

@filiptepper
Created February 17, 2010 21:07
Show Gist options
  • Save filiptepper/307007 to your computer and use it in GitHub Desktop.
Save filiptepper/307007 to your computer and use it in GitHub Desktop.
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