qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject qpid-proton git commit: PROTON-1488: Added command line parameters for configure URL and address
Date Tue, 23 May 2017 12:33:55 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/master f7490003d -> d6524051f


PROTON-1488: Added command line parameters for configure URL and address


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/d6524051
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/d6524051
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/d6524051

Branch: refs/heads/master
Commit: d6524051f9c9597c21402e83a8f243b51ca69426
Parents: f749000
Author: ppatierno <ppatierno@live.com>
Authored: Mon May 22 17:26:16 2017 +0200
Committer: Gordon Sim <gsim@redhat.com>
Committed: Tue May 23 13:33:06 2017 +0100

----------------------------------------------------------------------
 examples/python/server.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d6524051/examples/python/server.py
----------------------------------------------------------------------
diff --git a/examples/python/server.py b/examples/python/server.py
index 8cebaad..5d7650a 100755
--- a/examples/python/server.py
+++ b/examples/python/server.py
@@ -19,7 +19,8 @@
 #
 
 from __future__ import print_function
-from proton import Message
+import optparse
+from proton import Message, Url
 from proton.handlers import MessagingHandler
 from proton.reactor import Container
 
@@ -41,8 +42,15 @@ class Server(MessagingHandler):
         self.server.send(Message(address=event.message.reply_to, body=event.message.body.upper(),
                             correlation_id=event.message.correlation_id))
 
+parser = optparse.OptionParser(usage="usage: %prog [options]")
+parser.add_option("-a", "--address", default="localhost:5672/examples",
+                  help="address from which messages are received (default %default)")
+opts, args = parser.parse_args()
+
+url = Url(opts.address)
+
 try:
-    Container(Server("0.0.0.0:5672", "examples")).run()
+    Container(Server(url, url.path)).run()
 except KeyboardInterrupt: pass
 
 


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


Mime
View raw message