You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rh...@apache.org on 2010/03/04 14:16:27 UTC

svn commit: r918978 - in /qpid/trunk/qpid/python/qpid: messaging/driver.py messaging/message.py tests/messaging/message.py

Author: rhs
Date: Thu Mar  4 13:16:27 2010
New Revision: 918978

URL: http://svn.apache.org/viewvc?rev=918978&view=rev
Log:
added priority and ttl message properties

Modified:
    qpid/trunk/qpid/python/qpid/messaging/driver.py
    qpid/trunk/qpid/python/qpid/messaging/message.py
    qpid/trunk/qpid/python/qpid/tests/messaging/message.py

Modified: qpid/trunk/qpid/python/qpid/messaging/driver.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qpid/messaging/driver.py?rev=918978&r1=918977&r2=918978&view=diff
==============================================================================
--- qpid/trunk/qpid/python/qpid/messaging/driver.py (original)
+++ qpid/trunk/qpid/python/qpid/messaging/driver.py Thu Mar  4 13:16:27 2010
@@ -1057,6 +1057,10 @@
       mp.application_headers[TO] = msg.to
     if msg.durable:
       dp.delivery_mode = delivery_mode.persistent
+    if msg.priority is not None:
+      dp.priority = msg.priority
+    if msg.ttl is not None:
+      dp.ttl = msg.ttl
     enc, dec = get_codec(msg.content_type)
     body = enc(msg.content)
     def msg_acked():
@@ -1106,6 +1110,8 @@
       msg.reply_to = reply_to2addr(mp.reply_to)
     msg.correlation_id = mp.correlation_id
     msg.durable = dp.delivery_mode == delivery_mode.persistent
+    msg.priority = dp.priority
+    msg.ttl = dp.ttl
     msg.redelivered = dp.redelivered
     msg.properties = mp.application_headers
     msg.content_type = mp.content_type

Modified: qpid/trunk/qpid/python/qpid/messaging/message.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qpid/messaging/message.py?rev=918978&r1=918977&r2=918978&view=diff
==============================================================================
--- qpid/trunk/qpid/python/qpid/messaging/message.py (original)
+++ qpid/trunk/qpid/python/qpid/messaging/message.py Thu Mar  4 13:16:27 2010
@@ -90,7 +90,8 @@
 
   def __init__(self, content=None, content_type=UNSPECIFIED, id=None,
                subject=None, to=None, user_id=None, reply_to=None,
-               correlation_id=None, durable=None, properties=None):
+               correlation_id=None, durable=None, priority=None, ttl=None,
+               properties=None):
     """
     Construct a new message with the supplied content. The
     content-type of the message will be automatically inferred from
@@ -109,6 +110,8 @@
     self.reply_to = reply_to
     self.correlation_id = correlation_id
     self.durable = durable
+    self.priority = priority
+    self.ttl = ttl
     self.redelivered = False
     if properties is None:
       self.properties = {}
@@ -123,7 +126,7 @@
   def __repr__(self):
     args = []
     for name in ["id", "subject", "to", "user_id", "reply_to",
-                 "correlation_id"]:
+                 "correlation_id", "priority", "ttl"]:
       value = self.__dict__[name]
       if value is not None: args.append("%s=%r" % (name, value))
     for name in ["durable", "properties"]:

Modified: qpid/trunk/qpid/python/qpid/tests/messaging/message.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qpid/tests/messaging/message.py?rev=918978&r1=918977&r2=918978&view=diff
==============================================================================
--- qpid/trunk/qpid/python/qpid/tests/messaging/message.py (original)
+++ qpid/trunk/qpid/python/qpid/tests/messaging/message.py Thu Mar  4 13:16:27 2010
@@ -75,6 +75,9 @@
     assert msg.to == echo.to
     assert msg.reply_to == echo.reply_to
     assert msg.correlation_id == echo.correlation_id
+    assert msg.durable == echo.durable
+    assert msg.priority == echo.priority
+    assert msg.ttl == echo.ttl
     assert msg.properties == echo.properties
     assert msg.content_type == echo.content_type
     assert msg.content == echo.content, "%s, %s" % (msg, echo)
@@ -111,6 +114,9 @@
     msg.to = "to-address"
     msg.subject = "subject"
     msg.correlation_id = str(self.test_id)
+    msg.durable = True
+    msg.priority = 7
+    msg.ttl = 60
     msg.properties = MessageEchoTests.TEST_MAP
     msg.reply_to = "reply-address"
     self.check(msg)



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org