diff options
-rw-r--r-- | python/qpid/driver.py | 7 | ||||
-rw-r--r-- | python/qpid/tests/messaging.py | 11 |
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" |