summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2008-12-09 21:24:51 +0000
committerRafael H. Schloming <rhs@apache.org>2008-12-09 21:24:51 +0000
commit34433c2791b0901803a9f8906c9c4208ff19e986 (patch)
treef2279100a97f6387df5c78a063e169a67348d6e9 /python
parente64c807e9a4087f8e0b5f8ff5a31b408f49914bc (diff)
downloadqpid-python-34433c2791b0901803a9f8906c9c4208ff19e986.tar.gz
modified hello-world to optionally take a broker as an argument
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@724898 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python')
-rwxr-xr-xpython/hello-world13
1 files changed, 12 insertions, 1 deletions
diff --git a/python/hello-world b/python/hello-world
index 5d312e7371..efee84059c 100755
--- a/python/hello-world
+++ b/python/hello-world
@@ -17,12 +17,23 @@
# specific language governing permissions and limitations
# under the License.
#
+import sys
from qpid.connection import Connection
from qpid.util import connect
from qpid.datatypes import uuid4, Message
+broker = "127.0.0.1"
+port = 5672
+
+if len(sys.argv) > 1: broker = sys.argv[1]
+if len(sys.argv) > 2: port = int(sys.argv[2])
+
+if len(sys.argv) > 3:
+ print >> sys.stderr, "usage: hello-world [ <broker> [ <port> ] ]"
+ sys.exit(1)
+
# connect to the server and start a session
-conn = Connection(connect("127.0.0.1", 5672))
+conn = Connection(connect(broker, port))
conn.start()
ssn = conn.session(str(uuid4()))