From 73165063467db865c26ee256210dabcb97edd5e1 Mon Sep 17 00:00:00 2001 From: James Strachan Date: Wed, 14 Dec 2005 12:37:34 +0000 Subject: [PATCH] fixed the SpringBrokerContextListener to spin up a broker from an ActiveMQ XML file (or at least an XBean file) git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@356775 13f79535-47bb-0310-9956-ffa450edef68 --- activemq-web/project.xml | 19 ++++++++++++++---- .../web/SpringBrokerContextListener.java | 20 ++++++++++++------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/activemq-web/project.xml b/activemq-web/project.xml index dc34662cf6..0376c5806a 100755 --- a/activemq-web/project.xml +++ b/activemq-web/project.xml @@ -43,6 +43,17 @@ ${pom.currentVersion} + + + xbean + xbean-spring + ${xbean_spring_version} + http://www.gbean.org + + true + + + springframework @@ -53,11 +64,11 @@ true - + - activeio - activeio - ${activeio_version} + activeio + activeio + ${activeio_version} diff --git a/activemq-web/src/java/org/activemq/web/SpringBrokerContextListener.java b/activemq-web/src/java/org/activemq/web/SpringBrokerContextListener.java index 46c652afb7..a34d8f91ef 100644 --- a/activemq-web/src/java/org/activemq/web/SpringBrokerContextListener.java +++ b/activemq-web/src/java/org/activemq/web/SpringBrokerContextListener.java @@ -17,15 +17,15 @@ **/ package org.activemq.web; -import javax.servlet.ServletContext; -import javax.servlet.ServletContextListener; -import javax.servlet.ServletContextEvent; -import javax.jms.JMSException; - import org.activemq.broker.BrokerService; +import org.activemq.xbean.BrokerFactoryBean; import org.springframework.core.io.Resource; import org.springframework.web.context.support.ServletContextResource; +import javax.servlet.ServletContext; +import javax.servlet.ServletContextEvent; +import javax.servlet.ServletContextListener; + /** * Used to configure and instance of ActiveMQ BrokerService using * ActiveMQ/Spring's xml configuration.

The configuration file is specified @@ -105,7 +105,13 @@ public class SpringBrokerContextListener implements ServletContextListener { } context.log("Loading ActiveMQ Broker configuration from: " + brokerURI); Resource resource = new ServletContextResource(context, brokerURI); - // return SpringBrokerServiceFactory.newInstance(resource); - return null; + BrokerFactoryBean factory = new BrokerFactoryBean(resource); + try { + factory.afterPropertiesSet(); + } + catch (Exception e) { + context.log("Failed to create broker: " + e, e); + } + return factory.getBroker(); } }