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
This commit is contained in:
James Strachan 2005-12-14 12:37:34 +00:00
parent 829787ac1b
commit 7316506346
2 changed files with 28 additions and 11 deletions

View File

@ -43,6 +43,17 @@
<version>${pom.currentVersion}</version>
</dependency>
<!-- for custom XML parsing -->
<dependency>
<groupId>xbean</groupId>
<artifactId>xbean-spring</artifactId>
<version>${xbean_spring_version}</version>
<url>http://www.gbean.org</url>
<properties>
<war.bundle>true</war.bundle>
</properties>
</dependency>
<!-- For Spring servlet -->
<dependency>
<id>springframework</id>

View File

@ -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 <tt>BrokerService</tt> using
* ActiveMQ/Spring's xml configuration. <p/> 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();
}
}