summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2010-01-26 20:53:24 +0000
committerRafael H. Schloming <rhs@apache.org>2010-01-26 20:53:24 +0000
commitebb1c7b36f8b2756b686bf162e45c45d0d56f3ee (patch)
tree71d0063859ec1b05e55cfe453ea667c9646e103d
parent832887152f0cfbb0ff1d9ca3d3c5624818ecc87d (diff)
downloadqpid-python-ebb1c7b36f8b2756b686bf162e45c45d0d56f3ee.tar.gz
fixed subject override
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@903410 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--python/qpid/driver.py7
-rw-r--r--python/qpid/tests/messaging.py11
2 files changed, 14 insertions, 4 deletions
diff --git a/python/qpid/driver.py b/python/qpid/driver.py
index 7d203de588..1e295dd42f 100644
--- a/python/qpid/driver.py
+++ b/python/qpid/driver.py
@@ -839,11 +839,10 @@ class Driver:
sst = self._attachments[snd.session]
_snd = self._attachments[snd]
- # XXX: what if subject is specified for a normal queue?
- if _snd._routing_key is None:
- rk = msg.subject
- else:
+ if msg.subject is None or _snd._exchange == "":
rk = _snd._routing_key
+ else:
+ rk = msg.subject
# XXX: do we need to query to figure out how to create the reply-to interoperably?
if msg.reply_to:
rt = addr2reply_to(msg.reply_to)
diff --git a/python/qpid/tests/messaging.py b/python/qpid/tests/messaging.py
index ea4ae6a7fb..1fe9ad5f8c 100644
--- a/python/qpid/tests/messaging.py
+++ b/python/qpid/tests/messaging.py
@@ -765,6 +765,17 @@ test-bindings-additive-queue; {
snd_b.send(m4)
self.drain(rcv, expected=[m3, m4])
+ def testSubjectOverride(self):
+ snd = self.ssn.sender("amq.topic/a")
+ rcv_a = self.ssn.receiver("amq.topic/a")
+ rcv_b = self.ssn.receiver("amq.topic/b")
+ m1 = self.content("testSubjectOverride", 1)
+ m2 = self.content("testSubjectOverride", 2)
+ snd.send(m1)
+ snd.send(Message(subject="b", content=m2))
+ self.drain(rcv_a, expected=[m1])
+ self.drain(rcv_b, expected=[m2])
+
NOSUCH_Q = "this-queue-should-not-exist"
UNPARSEABLE_ADDR = "name/subject; {bad options"
UNLEXABLE_ADDR = "\0x0\0x1\0x2\0x3"