pika

Modify and re-queue a message using pika on python

Modify and re-queue a message using pika on python Question: I’m using Pika/RabbitMQ lib for processing messages in a python 3.8 project. When processing the messages the function can fail due to several reasons. There are a few cases when the message can be recovered in part if modified. I’m currently creating a new message …

Total answers: 1

Unable to perform RMQ publish from Locust "BlockingIOError: [WinError 10035]"

Unable to perform RMQ publish from Locust "BlockingIOError: [WinError 10035]" Question: My project requires client sending messages directly to Rabbit MQ and we need to do load testing for this. I tried PIKA, works fine in a plain python file but as soon as I tried to implement this in Locust I start getting error …

Total answers: 3

RabbitMQ Python PIKA – using add_callback_threadsafe lost acknowledgement when stopping program

RabbitMQ Python PIKA – using add_callback_threadsafe lost acknowledgement when stopping program Question: I’m using pika to process RabitMQ message by small batch, and using a thread for each batch. At the end of the function in the thread, I send acknowledgement of the messages through add_callback_threadsafe to the channel. In parallele I’m catching SIGINT signals …

Total answers: 1

Python – RabbitMQ Pika consumer – How to use async function as callback

Python – RabbitMQ Pika consumer – How to use async function as callback Question: I have the following code where I initialize a consumer listening to a queue. consumer = MyConsumer() consumer.declare_queue(queue_name="my-jobs") consumer.declare_exchange(exchange_name="my-jobs") consumer.bind_queue( exchange_name="my-jobs", queue_name="my-jobs", routing_key="jobs" ) consumer.consume_messages(queue="my-jobs", callback=consumer.consume) The problem is that the consume method is defined as follows: async def consume(self, channel, …

Total answers: 2

Right way to cancel rabbitmq consuming with pika

Right way to cancel rabbitmq consuming with pika Question: I want to implement rpc client using rabbitmq. My code primarily looks like def start(self): while True: self.channel.basic_consume(self.on_delivery) … client.start() // blocking call What is right way to stop this client ? Now I make channel.basic_cancel(self.on_cancel, self.consumer_tag) from another thread. However pika faq says It is …

Total answers: 2

How to create a delayed queue in RabbitMQ?

How to create a delayed queue in RabbitMQ? Question: What is the easiest way to create a delay (or parking) queue with Python, Pika and RabbitMQ? I have seen an similar questions, but none for Python. I find this an useful idea when designing applications, as it allows us to throttle messages that needs to …

Total answers: 6

Which form of connection to use with pika

Which form of connection to use with pika Question: I’ve been trying to figure out which form of connection i should use when using pika, I’ve got two alternatives as far as I understand. Either the BlockingConnection or the SelectConnection, however I’m not really sure about the differences between these two (i.e. what is the …

Total answers: 2