diff options
author | Rafael H. Schloming <rhs@apache.org> | 2010-03-04 13:16:27 +0000 |
---|---|---|
committer | Rafael H. Schloming <rhs@apache.org> | 2010-03-04 13:16:27 +0000 |
commit | 7b3ad011b0967eff639d46af344d506cf1254d85 (patch) | |
tree | 2af30cec77df3e13b78dc64072ce4bc515dcb8e1 | |
parent | 9e29f07bbb18a4892ae1a4141df907932877cabf (diff) | |
download | qpid-python-7b3ad011b0967eff639d46af344d506cf1254d85.tar.gz |
added priority and ttl message properties
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@918978 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/python/qpid/messaging/driver.py | 6 | ||||
-rw-r--r-- | qpid/python/qpid/messaging/message.py | 7 | ||||
-rw-r--r-- | qpid/python/qpid/tests/messaging/message.py | 6 |
3 files changed, 17 insertions, 2 deletions
diff --git a/qpid/python/qpid/messaging/driver.py b/qpid/python/qpid/messaging/driver.py index 3712bdd221..d0f5b746f3 100644 --- a/qpid/python/qpid/messaging/driver.py +++ b/qpid/python/qpid/messaging/driver.py @@ -1057,6 +1057,10 @@ class Engine: 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 @@ class Engine: 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 diff --git a/qpid/python/qpid/messaging/message.py b/qpid/python/qpid/messaging/message.py index 1c7c7beb81..46494e428e 100644 --- a/qpid/python/qpid/messaging/message.py +++ b/qpid/python/qpid/messaging/message.py @@ -90,7 +90,8 @@ class Message: 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 @@ class Message: 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 @@ class Message: 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"]: diff --git a/qpid/python/qpid/tests/messaging/message.py b/qpid/python/qpid/tests/messaging/message.py index ef2ec1aac4..930c031abb 100644 --- a/qpid/python/qpid/tests/messaging/message.py +++ b/qpid/python/qpid/tests/messaging/message.py @@ -75,6 +75,9 @@ class MessageEchoTests(Base): 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 @@ class MessageEchoTests(Base): 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) |