summaryrefslogtreecommitdiff
path: root/qpid/python
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
commit68ff613bfed3818aae03b9bc6f214484557468d0 (patch)
tree79bb62b196780485d18da76b9c48495bc4011dde /qpid/python
parenteb5fa270bd7aaf427eff44853ca0c1b42ed3389d (diff)
downloadqpid-python-68ff613bfed3818aae03b9bc6f214484557468d0.tar.gz
fixed subject override
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@903410 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/python')
-rw-r--r--qpid/python/qpid/driver.py7
-rw-r--r--qpid/python/qpid/tests/messaging.py11
2 files changed, 14 insertions, 4 deletions
diff --git a/qpid/python/qpid/driver.py b/qpid/python/qpid/driver.py
index 7d203de588..1e295dd42f 100644
--- a/qpid/python/qpid/driver.py
+++ b/qpid/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/qpid/python/qpid/tests/messaging.py b/qpid/python/qpid/tests/messaging.py
index ea4ae6a7fb..1fe9ad5f8c 100644
--- a/qpid/python/qpid/tests/messaging.py
+++ b/qpid/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"