This is a bit of a kludge, but I see in the Pika docs:
> | add_timeout(self, deadline, callback_method)
> | Add the callback_method to the IOLoop timer to fire after deadline
> | seconds. Returns a handle to the timeout. Do not confuse with
> | Tornado's timeout where you pass in the time you want to have your
> | callback called. Only pass in the seconds until it's to be called.
> |
> | :param int deadline: The number of seconds to wait to call callback
> | :param method callback_method: The callback method
> | :rtype: str
So maybe in MainThread you could do this:
def kill():
channel.stop_consuming()
connection.add_timeout(0, kill)
That would, in theory, schedule a call to the 'kill' method (which has a
reference to the channel) that can then call stop_consuming on that channel.
--
Stuart Longland (aka Redhatter, VK4MSL)
I haven't lost my mind...
...it's backed up on a tape somewhere.