You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2018/12/20 04:16:49 UTC

[qpid-proton] 02/02: PROTON-1986: [Python] Make example broker work with anonymous links - If you receive a message on a link with no target address then use the message address

This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git

commit ffe4915f609e1afe901d8cea7c38d3c0b83daa6e
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Wed Dec 19 22:56:26 2018 -0500

    PROTON-1986: [Python] Make example broker work with anonymous links
    - If you receive a message on a link with no target address then use the message address
---
 python/examples/broker.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/python/examples/broker.py b/python/examples/broker.py
index bbbd4f9..67eb216 100755
--- a/python/examples/broker.py
+++ b/python/examples/broker.py
@@ -112,7 +112,10 @@ class Broker(MessagingHandler):
         self._queue(event.link.source.address).dispatch(event.link)
 
     def on_message(self, event):
-        self._queue(event.link.target.address).publish(event.message)
+        address = event.link.target.address
+        if address is None:
+            address = event.message.address
+        self._queue(address).publish(event.message)
 
 parser = optparse.OptionParser(usage="usage: %prog [options]")
 parser.add_option("-a", "--address", default="localhost:5672",


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org