Branch 'dev' - moksha/hub
by Luke Macken
moksha/hub/messaging.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit fc36b9bc2970c611a4fb5063463f27cfd96df21d
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Jan 12 17:00:40 2011 -0500
Update our MessagingHub.subscribe method arguments
diff --git a/moksha/hub/messaging.py b/moksha/hub/messaging.py
index dc6fc08..56eb782 100644
--- a/moksha/hub/messaging.py
+++ b/moksha/hub/messaging.py
@@ -25,5 +25,5 @@ class MessagingHub(object):
def send_message(self, topic, message):
raise NotImplementedError
- def subscribe(self, topic):
+ def subscribe(self, topic, callback):
raise NotImplementedError
13 years, 5 months
Branch 'dev' - moksha/api
by Luke Macken
moksha/api/hub/consumer.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 349423f0cb112ae2ba663ad3c217897d462ef503
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Jan 7 20:14:15 2011 -0500
Typo
diff --git a/moksha/api/hub/consumer.py b/moksha/api/hub/consumer.py
index 5ce870f..1c5712c 100644
--- a/moksha/api/hub/consumer.py
+++ b/moksha/api/hub/consumer.py
@@ -25,6 +25,7 @@ loaded, and receives each message for the specified topic through the
.. moduleauthor:: Luke Macken <lmacken(a)redhat.com>
"""
+import uuid
import logging
log = logging.getLogger('moksha.hub')
@@ -49,8 +50,7 @@ class Consumer(object):
if isinstance(self.hub, AMQPLibHub):
# AMQPLibHub specific
- import uuid
- queue_name = str(uuid.uiud4())
+ queue_name = str(uuid.uuid4())
self.hub.queue_declare(queue=queue_name, exclusive=True)
self.hub.exchange_bind(queue_name, binding_key=topic)
if self.jsonify:
13 years, 5 months
Branch 'dev' - moksha/api
by Luke Macken
moksha/api/hub/consumer.py | 36 +++++++++++++++++++++++++-----------
1 file changed, 25 insertions(+), 11 deletions(-)
New commits:
commit 057ea1b0ef3457f3af04ce1a3b9ff6df86b6a4e6
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Jan 7 20:12:48 2011 -0500
Temporary hack around our leaking amqphub abstraction
diff --git a/moksha/api/hub/consumer.py b/moksha/api/hub/consumer.py
index 83b528f..5ce870f 100644
--- a/moksha/api/hub/consumer.py
+++ b/moksha/api/hub/consumer.py
@@ -29,6 +29,7 @@ import logging
log = logging.getLogger('moksha.hub')
from moksha.hub.hub import MokshaHub
+from moksha.hub.amqp.pyamqplib import AMQPLibHub
from moksha.lib.helpers import listify, create_app_engine, json
from sqlalchemy.orm import sessionmaker
@@ -45,18 +46,31 @@ class Consumer(object):
if self.hub.amqp_broker and not self.hub.stomp_broker:
for topic in listify(self.topic):
log.debug('Subscribing to consumer topic %s' % topic)
- server_queue_name = 'moksha_consumer_' + self.hub.session.name
- self.hub.queue_declare(queue=server_queue_name, exclusive=True)
- self.hub.exchange_bind(server_queue_name, binding_key=topic)
- local_queue_name = 'moksha_consumer_' + self.hub.session.name
- self.hub.local_queue = self.hub.session.incoming(local_queue_name)
- self.hub.message_subscribe(queue=server_queue_name,
- destination=local_queue_name)
- self.hub.local_queue.start()
- if self.jsonify:
- self.hub.local_queue.listen(self._consume_json)
+
+ if isinstance(self.hub, AMQPLibHub):
+ # AMQPLibHub specific
+ import uuid
+ queue_name = str(uuid.uiud4())
+ self.hub.queue_declare(queue=queue_name, exclusive=True)
+ self.hub.exchange_bind(queue_name, binding_key=topic)
+ if self.jsonify:
+ self.hub.subscribe(queue_name, self._consume_json)
+ else:
+ self.hub.subscribe(queue_name, self._consume)
else:
- self.hub.local_queue.listen(self._consume)
+ # Assume we're using Qpid then.
+ server_queue_name = 'moksha_consumer_' + self.hub.session.name
+ self.hub.queue_declare(queue=server_queue_name, exclusive=True)
+ self.hub.exchange_bind(server_queue_name, binding_key=topic)
+ local_queue_name = 'moksha_consumer_' + self.hub.session.name
+ self.hub.local_queue = self.hub.session.incoming(local_queue_name)
+ self.hub.message_subscribe(queue=server_queue_name,
+ destination=local_queue_name)
+ self.hub.local_queue.start()
+ if self.jsonify:
+ self.hub.local_queue.listen(self._consume_json)
+ else:
+ self.hub.local_queue.listen(self._consume)
# If the consumer specifies an 'app', then setup `self.engine` to
# be a SQLAlchemy engine, along with a configured DBSession
13 years, 5 months
Branch 'dev' - development.ini moksha/hub
by Luke Macken
development.ini | 1 +
moksha/hub/amqp/pyamqplib.py | 4 ++--
moksha/hub/amqp/qpid010.py | 2 +-
moksha/hub/hub.py | 5 ++++-
4 files changed, 8 insertions(+), 4 deletions(-)
New commits:
commit 66056971ccd26c619630f33030706befd62b60e2
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Jan 7 17:03:41 2011 -0500
Pass some more AMQP broker configuration through to the pyamqplib layer
diff --git a/development.ini b/development.ini
index 7b938e8..0ff234a 100644
--- a/development.ini
+++ b/development.ini
@@ -105,6 +105,7 @@ stomp_pass = guest
#amqp_broker_port = 5672
#amqp_broker_user = guest
#amqp_broker_pass = guest
+#amqp_broker_ssl = False
# Documentation directory
docs_dir = docs
diff --git a/moksha/hub/amqp/pyamqplib.py b/moksha/hub/amqp/pyamqplib.py
index fc0f5e4..b9ab46c 100644
--- a/moksha/hub/amqp/pyamqplib.py
+++ b/moksha/hub/amqp/pyamqplib.py
@@ -29,8 +29,8 @@ NONPERSISTENT_DELIVERY = PERSISTENT_DELIVERY = range(1, 3)
class AMQPLibHub(BaseAMQPHub):
""" An AMQPHub implemention using the amqplib module """
- def __init__(self, broker, username=None, password=None, ssl=False):
- self.conn = amqp.Connection(host=broker, ssl=ssl,
+ def __init__(self, broker, username=None, password=None, ssl=False, threaded=False):
+ self.conn = amqp.Connection(host=broker, ssl=ssl, use_threading=threaded,
userid=username, password=password)
self.channel = self.conn.channel()
self.channel.access_request('/data', active=True, write=True, read=True)
diff --git a/moksha/hub/amqp/qpid010.py b/moksha/hub/amqp/qpid010.py
index 980c67e..0460420 100644
--- a/moksha/hub/amqp/qpid010.py
+++ b/moksha/hub/amqp/qpid010.py
@@ -35,7 +35,7 @@ class QpidAMQPHub(BaseAMQPHub):
"""
- def __init__(self, broker):
+ def __init__(self, broker, **kw):
self.set_broker(broker)
self.socket = connect(self.host, self.port)
if self.url.scheme == URL.AMQPS:
diff --git a/moksha/hub/hub.py b/moksha/hub/hub.py
index 819f098..5371474 100644
--- a/moksha/hub/hub.py
+++ b/moksha/hub/hub.py
@@ -72,7 +72,10 @@ class MokshaHub(StompHub, AMQPHub):
self.topics[topic].append(callback)
if self.amqp_broker:
- AMQPHub.__init__(self, self.amqp_broker)
+ AMQPHub.__init__(self, self.amqp_broker,
+ username=config.get('amqp_broker_user', 'guest'),
+ password=config.get('amqp_broker_pass', 'guest'),
+ ssl=config.get('amqp_broker_ssl', False))
if self.stomp_broker:
log.info('Initializing STOMP support')
13 years, 5 months
Changes to 'dev'
by Luke Macken
New branch 'dev' available with the following commits:
commit a23bea017d53dc56adad9edcaacee97236667237
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Jan 7 16:19:25 2011 -0500
Try to fall back to pyamqplib if qpid doesn't exist
13 years, 5 months
3 commits - docs/main moksha.spec setup.py
by Luke Macken
docs/main/Deployment.rst | 18 +++++-------------
moksha.spec | 3 +--
setup.py | 2 +-
3 files changed, 7 insertions(+), 16 deletions(-)
New commits:
commit 35ae482f0aa298f8e3b4cf7411ad7f47dd4209f0
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Jan 7 16:06:01 2011 -0500
Require Orbited in our moksha-server subpackage
diff --git a/moksha.spec b/moksha.spec
index ae920ab..45ba9a1 100644
--- a/moksha.spec
+++ b/moksha.spec
@@ -32,7 +32,6 @@ BuildRequires: python-repoze-what-quickstart
BuildRequires: python-shove
BuildRequires: python-bunch
BuildRequires: TurboGears2
-BuildRequires: orbited
Requires: TurboGears2
Requires: python-toscawidgets >= 0.9.1
@@ -41,7 +40,6 @@ Requires: python-shove
Requires: python-feedcache
Requires: python-feedparser
Requires: python-tw-jquery >= 0.9.4.1
-Requires: orbited
Requires: python-sphinx
Requires: python-paver
Requires: python-tw-forms
@@ -75,6 +73,7 @@ Summary: mod_wsgi Moksha server
Group: Applications/Internet
Requires: %{name} = %{version}-%{release}
Requires: mod_wsgi httpd
+Requires: orbited
%description server
This package contains an Apache mod_wsgi configuration for Moksha.
commit da819e2ee77211ac8efcd3f9b2d71201c81a4de4
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Jan 7 16:05:52 2011 -0500
Some tweaks to our Deployment doc
diff --git a/docs/main/Deployment.rst b/docs/main/Deployment.rst
index 677117a..1bcc866 100644
--- a/docs/main/Deployment.rst
+++ b/docs/main/Deployment.rst
@@ -16,23 +16,13 @@ Once extracted, comment out the ToscaWidgets alias in your
`/etc/httpd/conf.d/moksha.conf`.
-Running orbited
----------------
-
-.. code-block:: bash
-
- $ orbited -c /etc/moksha/orbited.cfg
-
-
Setting up an AMQP message broker
---------------------------------
-By default Moksha utilizes the embeded MorbidQ message broker inside of
-Orbited. This allows for widgets to communicate with the server using the
-Stomp protocol. In production you can easily switch to an enterprise-grade
-message broker, such as `Apache Qpid <http://qpid.apache.org>`_.
+In production you can easily switch to an enterprise-grade message broker, such
+as `Apache Qpid <http://qpid.apache.org>`_.
-See the documentatoin on :doc:`MessageBrokers` for how to hook up an AMQP broker.
+See the documentation on :doc:`MessageBrokers` for details on how to hook up an AMQP broker.
.. seealso::
@@ -50,4 +40,6 @@ to utlize the memcached Beaker extension. This example uses two memcached serve
beaker.cache.type = ext:memcached
beaker.cache.url = memcached1;memcached2
+.. seealso::
+ `Caching with TurboGears <http://turbogears.org/2.1/docs/main/Caching.html>`
commit 181067b352161efc37c629e4a67844b2a4a0ff8e
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Jan 7 16:03:20 2011 -0500
Development versions of Orbited have been slipping out to PyPi, breaking
Moksha, so hardcode the version dep.
diff --git a/setup.py b/setup.py
index d218d9a..64ce716 100644
--- a/setup.py
+++ b/setup.py
@@ -30,7 +30,7 @@ setup(
"feedcache",
"feedparser",
"tw.jquery>=0.9.9",
- "orbited",
+ "orbited==0.7.10",
#"Twisted",
"stomper",
"Sphinx",
13 years, 5 months