demo/demo/controllers/root.py | 2 +-
moksha/api/widgets/amqp/amqp.py | 19 +++++++++++++++++++
moksha/api/widgets/stomp/stomp.py | 9 +++++++++
moksha/commands/cli.py | 2 +-
moksha/templates/amqp_socket.mak | 17 +++++++++++++++++
moksha/templates/stomp_socket.mak | 7 +++++++
6 files changed, 54 insertions(+), 2 deletions(-)
New commits:
commit 7dd733953c585ae27b2a6cf242b5cd15e9d10c1d
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Oct 28 15:40:25 2010 -0400
Run the moksha-hub in verbose mode
diff --git a/moksha/commands/cli.py b/moksha/commands/cli.py
index 5915fcf..2988a69 100755
--- a/moksha/commands/cli.py
+++ b/moksha/commands/cli.py
@@ -62,7 +62,7 @@ class MokshaCLI(object):
self._exec(*orbited)
self._exec('paster', 'serve', get_moksha_config_path())
- self._exec('moksha-hub')
+ self._exec('moksha-hub', '-v')
def list(self):
""" List all available apps, widgets, producers and consumers
"""
commit 956f405337ceb397b1252a96518eeb2c111b156e
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Oct 28 15:39:58 2010 -0400
We renamed our live widget
diff --git a/demo/demo/controllers/root.py b/demo/demo/controllers/root.py
index 35593b1..d31128c 100644
--- a/demo/demo/controllers/root.py
+++ b/demo/demo/controllers/root.py
@@ -15,7 +15,7 @@ class Root(object):
@expose('mako:moksha.templates.widget')
def livewidget(self, *args, **kwargs):
- tmpl_context.widget = moksha.get_widget('helloworld')
+ tmpl_context.widget = moksha.get_widget('live')
tmpl_context.moksha_socket = moksha.get_widget('moksha_socket')
return dict(options={})
commit 30818c4e4a738e6b19cb5476d60e966d210115e2
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Oct 28 15:01:16 2010 -0400
Add moksha.send_message functions to our AMQP & STOMP sockets
diff --git a/moksha/api/widgets/amqp/amqp.py b/moksha/api/widgets/amqp/amqp.py
index 75da86e..785a1a5 100644
--- a/moksha/api/widgets/amqp/amqp.py
+++ b/moksha/api/widgets/amqp/amqp.py
@@ -159,6 +159,25 @@ class AMQPSocket(Widget):
${onconnectedframe}
moksha_amqp_queue.start();
}
+
+ if (typeof moksha == 'undefined') {
+ moksha = {
+ /* Send an AMQP message to a given topic */
+ send_message: function(topic, body) {
+ moksha_amqp_session.Message('transfer', {
+ accept_mode: 1,
+ acquire_mode: 1,
+ destination: 'amq.topic',
+ _body: $.toJSON(body),
+ _header: {
+ delivery_properties: {
+ routing_key: topic
+ }
+ }
+ });
+ },
+ }
+ }
</script>
"""
hidden = True
diff --git a/moksha/api/widgets/stomp/stomp.py b/moksha/api/widgets/stomp/stomp.py
index 87dc4b4..51c7c13 100644
--- a/moksha/api/widgets/stomp/stomp.py
+++ b/moksha/api/widgets/stomp/stomp.py
@@ -148,6 +148,15 @@ class StompWidget(Widget):
}
}
+ if (typeof moksha == 'undefined') {
+ moksha = {
+ /* Send a STOMP message to a given topic */
+ send_message: function(topic, body) {
+ stomp.send($.toJSON(body), topic)
+ }
+ }
+ }
+
% if notify:
$.jGrowl.defaults.position = 'bottom-right';
% endif
diff --git a/moksha/templates/amqp_socket.mak b/moksha/templates/amqp_socket.mak
index 9e8bb6f..667119f 100644
--- a/moksha/templates/amqp_socket.mak
+++ b/moksha/templates/amqp_socket.mak
@@ -1,3 +1,20 @@
+moksha = {
+ /* Send an AMQP message to a given topic */
+ send_message: function(topic, body) {
+ moksha_amqp_session.Message('transfer', {
+ accept_mode: 1,
+ acquire_mode: 1,
+ destination: 'amq.topic',
+ _body: $.toJSON(body),
+ _header: {
+ delivery_properties: {
+ routing_key: topic
+ }
+ }
+ });
+ },
+}
+
if (typeof moksha_amqp_conn == 'undefined') {
moksha_callbacks = new Object();
moksha_amqp_remote_queue = null;
diff --git a/moksha/templates/stomp_socket.mak b/moksha/templates/stomp_socket.mak
index e4eb0cd..bcf252a 100644
--- a/moksha/templates/stomp_socket.mak
+++ b/moksha/templates/stomp_socket.mak
@@ -1,3 +1,10 @@
+moksha = {
+ /* Send a STOMP message to a given topic */
+ send_message: function(topic, body) {
+ stomp.send($.toJSON(body), topic)
+ },
+}
+
if (typeof TCPSocket == 'undefined') {
moksha_callbacks = new Object();
moksha_socket_busy = false;
Show replies by date