mirror of https://github.com/apache/activemq.git
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:
parent
829787ac1b
commit
7316506346
|
@ -43,6 +43,17 @@
|
||||||
<version>${pom.currentVersion}</version>
|
<version>${pom.currentVersion}</version>
|
||||||
</dependency>
|
</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 -->
|
<!-- For Spring servlet -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<id>springframework</id>
|
<id>springframework</id>
|
||||||
|
@ -53,11 +64,11 @@
|
||||||
<war.bundle>true</war.bundle>
|
<war.bundle>true</war.bundle>
|
||||||
</properties>
|
</properties>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>activeio</groupId>
|
<groupId>activeio</groupId>
|
||||||
<artifactId>activeio</artifactId>
|
<artifactId>activeio</artifactId>
|
||||||
<version>${activeio_version}</version>
|
<version>${activeio_version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- optional used for in-web container testing -->
|
<!-- optional used for in-web container testing -->
|
||||||
|
|
|
@ -17,15 +17,15 @@
|
||||||
**/
|
**/
|
||||||
package org.activemq.web;
|
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.broker.BrokerService;
|
||||||
|
import org.activemq.xbean.BrokerFactoryBean;
|
||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
import org.springframework.web.context.support.ServletContextResource;
|
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
|
* Used to configure and instance of ActiveMQ <tt>BrokerService</tt> using
|
||||||
* ActiveMQ/Spring's xml configuration. <p/> The configuration file is specified
|
* 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);
|
context.log("Loading ActiveMQ Broker configuration from: " + brokerURI);
|
||||||
Resource resource = new ServletContextResource(context, brokerURI);
|
Resource resource = new ServletContextResource(context, brokerURI);
|
||||||
// return SpringBrokerServiceFactory.newInstance(resource);
|
BrokerFactoryBean factory = new BrokerFactoryBean(resource);
|
||||||
return null;
|
try {
|
||||||
|
factory.afterPropertiesSet();
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
context.log("Failed to create broker: " + e, e);
|
||||||
|
}
|
||||||
|
return factory.getBroker();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue