You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rh...@apache.org on 2008/12/09 22:24:52 UTC
svn commit: r724898 - /incubator/qpid/trunk/qpid/python/hello-world
Author: rhs
Date: Tue Dec 9 13:24:51 2008
New Revision: 724898
URL: http://svn.apache.org/viewvc?rev=724898&view=rev
Log:
modified hello-world to optionally take a broker as an argument
Modified:
incubator/qpid/trunk/qpid/python/hello-world
Modified: incubator/qpid/trunk/qpid/python/hello-world
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/hello-world?rev=724898&r1=724897&r2=724898&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/python/hello-world (original)
+++ incubator/qpid/trunk/qpid/python/hello-world Tue Dec 9 13:24:51 2008
@@ -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()))