From the description in the pika
documentation, I can't quite get what add_callback_threadsafe()
method does. It says, "Requests a call to the given function as soon as possible in the context of this connection’s thread". Specifically, which event does this callback get associated to? Since, add_callback_threadsafe()
doesn't receive any "event" argument, how does pika
know when to invoke that callback?
Also, in the official example, why do we even need to build the partial function and register the callback in the do_work() method? Could we not just call the ack_message()
method after the time.sleep()
is over?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…