You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2010/12/13 21:02:09 UTC
svn commit: r1045348 - in /activemq/activemq-apollo/trunk: ./
apollo-distro/src/main/release/examples/python/
Author: chirino
Date: Mon Dec 13 20:02:08 2010
New Revision: 1045348
URL: http://svn.apache.org/viewvc?rev=1045348&view=rev
Log:
Added a python client lib and examples to the distribution.
Added:
activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/python/
activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/python/listener.py (with props)
activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/python/publisher.py (with props)
activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/python/readme.md
activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/python/stomp.py-3.0.2a.tar.gz
Modified:
activemq/activemq-apollo/trunk/NOTICE
Modified: activemq/activemq-apollo/trunk/NOTICE
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/NOTICE?rev=1045348&r1=1045347&r2=1045348&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/NOTICE (original)
+++ activemq/activemq-apollo/trunk/NOTICE Mon Dec 13 20:02:08 2010
@@ -1,8 +1,14 @@
+-----------------------------------------------------------------------
-ActiveMQ
+ActiveMQ Apollo
Copyright 2005-2009 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
+-----------------------------------------------------------------------
+This product includes some software developed by
+the stomppy project (http://code.google.com/p/stomppy/).
+
+-----------------------------------------------------------------------
Added: activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/python/listener.py
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/python/listener.py?rev=1045348&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/python/listener.py (added)
+++ activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/python/listener.py Mon Dec 13 20:02:08 2010
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+# ------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ------------------------------------------------------------------------
+
+import time
+import sys
+import os
+import stomp
+
+user = os.getenv("STOMP_USER") or "admin"
+password = os.getenv("STOMP_PASSWORD") or "password"
+host = os.getenv("STOMP_HOST") or "localhost"
+port = os.getenv("STOMP_PORT") or 61613
+destination = sys.argv[1:2] or ["/topic/event"]
+destination = destination[0]
+
+class MyListener(object):
+
+ def __init__(self, conn):
+ self.conn = conn
+ self.count = 0
+ self.start = time.time()
+
+ def on_error(self, headers, message):
+ print('received an error %s' % message)
+
+ def on_message(self, headers, message):
+ if message == "SHUTDOWN":
+
+ diff = time.time() - self.start
+ print("Received %s in %f seconds" % (self.count, diff))
+ conn.disconnect()
+
+ else:
+ if self.count==0:
+ self.start = time.time()
+
+ self.count += 1
+ if self.count % 1000 == 0:
+ print("Received %s messages." % self.count)
+
+conn = stomp.Connection(host_and_ports = [(host, port)])
+conn.set_listener('', MyListener(conn))
+conn.start()
+conn.connect(login=user,passcode=password)
+conn.subscribe(destination=destination, ack='auto')
Propchange: activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/python/listener.py
------------------------------------------------------------------------------
svn:executable = *
Added: activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/python/publisher.py
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/python/publisher.py?rev=1045348&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/python/publisher.py (added)
+++ activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/python/publisher.py Mon Dec 13 20:02:08 2010
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+# ------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ------------------------------------------------------------------------
+
+import time
+import sys
+import os
+import stomp
+
+user = os.getenv("STOMP_USER") or "admin"
+password = os.getenv("STOMP_PASSWORD") or "password"
+host = os.getenv("STOMP_HOST") or "localhost"
+port = os.getenv("STOMP_PORT") or 61613
+destination = sys.argv[1:2] or ["/topic/event"]
+destination = destination[0]
+
+messages = 10000
+data = "Hello World from Python"
+
+conn = stomp.Connection(host_and_ports = [(host, port)])
+conn.start()
+conn.connect(login=user,passcode=password)
+
+for i in range(0, messages):
+ conn.send(data, destination=destination, persistent='false')
+
+conn.send("SHUTDOWN", destination=destination, persistent='false')
+
+conn.disconnect()
\ No newline at end of file
Propchange: activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/python/publisher.py
------------------------------------------------------------------------------
svn:executable = *
Added: activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/python/readme.md
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/python/readme.md?rev=1045348&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/python/readme.md (added)
+++ activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/python/readme.md Mon Dec 13 20:02:08 2010
@@ -0,0 +1,9 @@
+## Installing the stomppy Library
+
+The [stomppy](http://code.google.com/p/stomppy) python client distribution is
+included in this directory. It must be installed before the examples are run.
+
+ tar -zxvf stomp.py-3.0.2a.tar.gz
+ cd stomp.py-3.0.2
+ python ./setup.py install
+
Added: activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/python/stomp.py-3.0.2a.tar.gz
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/python/stomp.py-3.0.2a.tar.gz?rev=1045348&view=auto
==============================================================================
Files activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/python/stomp.py-3.0.2a.tar.gz (added) and activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/python/stomp.py-3.0.2a.tar.gz Mon Dec 13 20:02:08 2010 differ