From 8b2fa8def606360c35e3a1b2d0c4700754715674 Mon Sep 17 00:00:00 2001 From: Gabriele Santomaggio Date: Fri, 24 Oct 2025 15:43:11 +0200 Subject: [PATCH] set durable true Signed-off-by: Gabriele Santomaggio --- rabbitmq_amqp_python_client/qpid/proton/_message.py | 4 ++-- tests/test_publisher.py | 11 ----------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/rabbitmq_amqp_python_client/qpid/proton/_message.py b/rabbitmq_amqp_python_client/qpid/proton/_message.py index bcd01cc..f30e91a 100644 --- a/rabbitmq_amqp_python_client/qpid/proton/_message.py +++ b/rabbitmq_amqp_python_client/qpid/proton/_message.py @@ -110,7 +110,7 @@ class Message(object): """ Default AMQP message priority""" def __init__( - self, body: Union[bytes, None] = None, inferred=True, durable=True, **kwargs + self, body: Union[bytes, None] = None, inferred=True, **kwargs ) -> None: # validate the types @@ -120,7 +120,7 @@ def __init__( self.application_properties = None self.body = body self.inferred = inferred - self.durable = durable + self.durable = True for k, v in kwargs.items(): getattr(self, k) # Raise exception if it's not a valid attribute. diff --git a/tests/test_publisher.py b/tests/test_publisher.py index 134aea9..2b72912 100644 --- a/tests/test_publisher.py +++ b/tests/test_publisher.py @@ -465,22 +465,11 @@ def test_durable_message(connection: Connection) -> None: assert status.remote_state == OutcomeState.ACCEPTED # message should be not durable by setting the durable to False by the user - m = Message( - body=Converter.string_to_bytes("not durable"), - durable=False, - ) - status = publisher.publish(m) - assert status.remote_state == OutcomeState.ACCEPTED consumer = connection.consumer(destination) should_be_durable = consumer.consume() assert should_be_durable.durable is True consumer.close() - # it does not work due of https://github.com/rabbitmq/rabbitmq-amqp-python-client/issues/83 - # should_be_not_durable = consumer.consume() - # assert should_be_not_durable.durable is False - # message_count = management.purge_queue(queue_name) management.purge_queue(queue_name) - # assert message_count == 0 management.delete_queue(queue_name)