def schedule(self, f, *args, **kwargs):
"""
Try to acquire connection access lock. Then call protocol method.
Return concurrent Future instance you can wait in the other
thread.
"""
self.wait_open()
# RabbitMQ operations are multiplexed between different AMQP
# method callbacks. Final result of the protocol method call
# will be set inside one of this callbacks. So other thread
# will be able to wait unless this event happens in the
# connection event loop.
future = Future()
with self.lock:
self.process(get_ident(), (f, args, kwargs), future)
return future
评论列表
文章目录