add class to transfer messages from one queue to another queue

This commit is contained in:
2024-04-18 17:37:45 +02:00
parent 48b36a4416
commit e5e9a8d09e
2 changed files with 44 additions and 1 deletions
+3 -1
View File
@@ -29,7 +29,9 @@ class CookiesPublisher:
def publish_body(self, body: str):
print("will push to queue {}".format(self.to_queue))
self.channel.basic_publish(exchange='', routing_key=self.to_queue, body=body)
self.channel.basic_publish(exchange='', routing_key=self.to_queue, body=body, properties=pika.BasicProperties(
delivery_mode=pika.spec.PERSISTENT_DELIVERY_MODE
))
def message_count(self):
return self.channel.queue_declare(queue=self.to_queue, durable=True).method.message_count