# This file is part of Moksha.
# Copyright (C) 2008-2009  Red Hat, Inc.
# 
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from live import LiveWidget, subscribe_topics, unsubscribe_topics

# At the moment we're using the StompWidget as our primary publish/subscribe
# messaging standard.  If we want to change the default to an AMQP widget
# down the road, we would change it here so we have a consistent API to
# develop against.

#from moksha.api.widgets.stomp import StompWidget
#moksha_socket = StompWidget

from moksha.api.widgets.amqp import AMQPSocket
moksha_socket = AMQPSocket

@@ -66,17 +66,16 @@
 , Inc.%0A#
- 
 %0A# This 
@@ -323,17 +323,16 @@
 rsion.%0A#
- 
 %0A# This 
@@ -574,17 +574,16 @@
 tails.%0A#
- 
 %0A# You s
@@ -723,16 +723,31 @@
 ses/%3E.%0A%0A
+import pylons%0A%0A
 from liv
@@ -808,402 +808,488 @@
 ics%0A
-%0A# At the moment we're using the StompWidget as our primary publish/subscribe%0A# messaging standard.  If we want to change the default to an AMQP widget%0A# down the road, we would change it here so we have a consistent API to%0A# develop against.%0A%0A#from moksha.api.widgets.stomp import StompWidget%0A#moksha_socket = StompWidget%0A%0Afrom moksha.api.widgets.amqp import AMQPSocket%0A
+from moksha.api.widgets.stomp import StompWidget%0Afrom moksha.api.widgets.amqp import AMQPSocket%0A%0Alivesocket_backend = pylons.config.get('moksha.livesocket.backend', 'stomp').lower()%0Aif livesocket_backend == 'stomp':%0A    moksha_socket = StompWidget%0Aelif livesocket_backend == 'amqp':%0A    moksha_socket = AMQPSocket%0Aelse:%0A    raise Exception(%22Unknown %60
 moksha
-_
+.live
 socket
- = AMQPSocket
+.backend%60 %25r.  Available backends: %22%0A                    %22stomp, amqp%22 %25 livesocket_backend)%0Adel(livesocket_backend)
 %0A

Make our moksha_socket configurable.