From 1df5e6aeaca0055c39096cb8ade612e60f331600 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl>
Date: Wed, 13 Nov 2024 15:08:40 +0100
Subject: [PATCH] argumentify added

---
 CHANGELOG.md          | 1 +
 coolamqp/objects.py   | 6 +++++-
 docs/how-to-guide.rst | 9 +++++++++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 845d169..169ff00 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@ v2.0.1
 ======
 
 * removed extra logging from argumentify
+* user will be notified upon declaring an auto-delete durable exchange
 
 v2.0.0
 ======
diff --git a/coolamqp/objects.py b/coolamqp/objects.py
index aae99be..ac92a97 100644
--- a/coolamqp/objects.py
+++ b/coolamqp/objects.py
@@ -37,7 +37,7 @@ class MessageProperties(BasicContentPropertyList):
         :type correlation_id: binary type (max length 255) (AMQP as shortstr)
         :param reply_to: address to reply to
         :type reply_to: binary type (max length 255) (AMQP as shortstr)
-        :param expiration: message expiration specification
+        :param expiration: message expiration specification (in milliseconds)
         :type expiration: binary type (max length 255) (AMQP as shortstr)
         :param message_id: application message identifier
         :type message_id: binary type (max length 255) (AMQP as shortstr)
@@ -207,6 +207,7 @@ class Exchange(object):
 
     :param name: exchange name
     :param arguments: either a list of (bytes, values) or a dict of (str, value) to pass as an extra argument
+    :param type: type of the exchange. So far, valid types are 'direct', 'fanout', 'topic' and 'headers'
     """
     __slots__ = ('name', 'type', 'durable', 'auto_delete', 'arguments')
 
@@ -224,6 +225,9 @@ class Exchange(object):
         self.auto_delete = auto_delete
         self.arguments = argumentify(arguments)
 
+        if self.auto_delete and self.durable:
+            warnings.warn('What is your purpose in declaring a durable auto-delete exchange?', UserWarning)
+
         assert isinstance(self.name, six.text_type)
         assert isinstance(self.type, six.binary_type)
 
diff --git a/docs/how-to-guide.rst b/docs/how-to-guide.rst
index 951506c..48055ba 100644
--- a/docs/how-to-guide.rst
+++ b/docs/how-to-guide.rst
@@ -102,3 +102,12 @@ In order to make use of an anonymous queue, you must first :meth:`coolamqp.clust
 raise ValueError if you try to do that, anyway.
 
 Anonymous queues must be auto_delete and exclusive, ValueError will be raised otherwise.
+
+Who am I talking to?
+--------------------
+
+To identify the server you're talking to just connect and use :meth:`coolamqp.clustering.Cluster.properties`,
+which will return the following class:
+
+.. autoclass:: coolamqp.objects.ServerProperties
+    :members:
-- 
GitLab