mirror of https://github.com/apache/activemq.git
Patch applied for https://issues.apache.org/activemq/browse/AMQ-1237
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@695445 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f2fc86405f
commit
398b468b68
|
@ -44,6 +44,8 @@ public class CommandAgent implements Service, InitializingBean, DisposableBean,
|
|||
private static final Log LOG = LogFactory.getLog(CommandAgent.class);
|
||||
|
||||
private String brokerUrl = "vm://localhost";
|
||||
private String username;
|
||||
private String password;
|
||||
private ConnectionFactory connectionFactory;
|
||||
private Connection connection;
|
||||
private Destination commandDestination;
|
||||
|
@ -124,6 +126,22 @@ public class CommandAgent implements Service, InitializingBean, DisposableBean,
|
|||
this.brokerUrl = brokerUrl;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public ConnectionFactory getConnectionFactory() {
|
||||
if (connectionFactory == null) {
|
||||
connectionFactory = new ActiveMQConnectionFactory(brokerUrl);
|
||||
|
@ -160,7 +178,7 @@ public class CommandAgent implements Service, InitializingBean, DisposableBean,
|
|||
}
|
||||
|
||||
protected Connection createConnection() throws JMSException {
|
||||
return getConnectionFactory().createConnection();
|
||||
return getConnectionFactory().createConnection(username, password);
|
||||
}
|
||||
|
||||
protected Destination createCommandDestination() {
|
||||
|
|
|
@ -24,7 +24,11 @@
|
|||
http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
|
||||
|
||||
<!-- Allows us to use system properties as variables in this configuration file -->
|
||||
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
|
||||
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
||||
<property name="locations">
|
||||
<value>file://${activemq.base}/conf/credentials.properties</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.base}/data">
|
||||
|
||||
|
@ -133,14 +137,20 @@
|
|||
|
||||
<!-- configure the camel activemq component to use the current broker -->
|
||||
<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent" >
|
||||
<property name="connectionFactory">
|
||||
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
|
||||
<property name="brokerURL" value="vm://localhost?create=false&waitForStart=10000" />
|
||||
<property name="userName" value="${activemq.username}"/>
|
||||
<property name="password" value="${activemq.password}"/>
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
|
||||
|
||||
<!-- Uncomment to create a command agent to respond to message based admin commands on the ActiveMQ.Agent topic -->
|
||||
<!--
|
||||
<commandAgent xmlns="http://activemq.apache.org/schema/core" brokerUrl="vm://localhost"/>
|
||||
<commandAgent xmlns="http://activemq.apache.org/schema/core" brokerUrl="vm://localhost" username="${activemq.username}" password="${activemq.password}"/>
|
||||
-->
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
activemq.username=system
|
||||
activemq.password=manager
|
|
@ -18,7 +18,11 @@
|
|||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<beans>
|
||||
|
||||
<bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />
|
||||
<bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
||||
<property name="locations">
|
||||
<value>file://${activemq.base}/conf/credentials.properties</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- use the following bean for a local in-JVM broker -->
|
||||
<bean id="brokerQuery" class="org.apache.activemq.web.SingletonBrokerFacade" autowire='constructor' singleton="false"/>
|
||||
|
@ -30,6 +34,8 @@
|
|||
|
||||
<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
|
||||
<property name="brokerURL" value="vm://localhost"/>
|
||||
<property name="userName" value="${activemq.username}"/>
|
||||
<property name="password" value="${activemq.password}"/>
|
||||
</bean>
|
||||
|
||||
<bean id="queueBrowser" class="org.apache.activemq.web.QueueBrowseQuery" autowire='constructor' singleton="false"/>
|
||||
|
|
Loading…
Reference in New Issue