Channel methods
Functions for calling channel methods from a consumer callback running in another thread.
-
yapw.methods.publish(state, channel, message, routing_key, *args, **kwargs)[source]
Publish the message with the routing_key, to the exchange set by the state.
- Parameters:
state (State[Any]) – an object with thread-safe attributes from the client
channel (Channel) – the channel from which to call basic_publish
message (Any) – a decoded message
routing_key (str) – the routing key
args (Any)
kwargs (Any)
- Return type:
None
-
yapw.methods.ack(state, channel, delivery_tag=0, **kwargs)[source]
Ack a message by its delivery tag.
- Parameters:
state (State[Any]) – an object with thread-safe attributes from the client
channel (Channel) – the channel from which to call basic_ack
delivery_tag (int | None) – the delivery tag
kwargs (bool)
- Return type:
None
-
yapw.methods.nack(state, channel, delivery_tag=0, **kwargs)[source]
Nack a message by its delivery tag.
- Parameters:
state (State[Any]) – an object with thread-safe attributes from the client
channel (Channel) – the channel from which to call basic_nack
delivery_tag (int | None) – the delivery tag
kwargs (bool)
- Return type:
None
-
yapw.methods.add_callback_threadsafe(connection, callback)[source]
Interact with Pika from another thread.
- Parameters:
-
- Return type:
None