This closes #784

This commit is contained in:
Clebert Suconic 2016-09-21 17:09:38 -04:00
commit 5ea53c48e8
3 changed files with 27 additions and 0 deletions

View File

@ -2451,6 +2451,12 @@ public class ActiveMQServerImpl implements ActiveMQServer {
securityRepository.swap(config.getSecurityRoles().entrySet());
ActiveMQServerLogger.LOGGER.reloadingConfiguration("address settings");
addressSettingsRepository.swap(config.getAddressesSettings().entrySet());
ActiveMQServerLogger.LOGGER.reloadingConfiguration("diverts");
for (DivertConfiguration divertConfig : config.getDivertConfigurations()) {
if (postOffice.getBinding(new SimpleString(divertConfig.getName())) == null) {
deployDivert(divertConfig);
}
}
}
}
}

View File

@ -20,6 +20,7 @@ package org.apache.activemq.artemis.tests.integration.jms;
import javax.jms.Connection;
import javax.jms.JMSException;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
import java.net.URL;
@ -75,6 +76,18 @@ public class RedeployTest extends ActiveMQTestBase {
Assert.assertEquals("jms.queue.NewQueue", embeddedJMS.getActiveMQServer().getAddressSettingsRepository().getMatch("jms").getDeadLetterAddress().toString());
Assert.assertEquals("jms.queue.NewQueue", embeddedJMS.getActiveMQServer().getAddressSettingsRepository().getMatch("jms").getExpiryAddress().toString());
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
try (Connection connection = factory.createConnection()) {
Session session = connection.createSession();
Queue queue = session.createQueue("DivertQueue");
MessageProducer producer = session.createProducer(queue);
producer.send(session.createTextMessage("text"));
connection.start();
MessageConsumer consumer = session.createConsumer(session.createQueue("NewQueue"));
Assert.assertNotNull("Divert wasn't redeployed accordingly", consumer.receive(5000));
}
}
finally {
embeddedJMS.stop();

View File

@ -26,6 +26,7 @@ under the License.
<queue name="DLQ"/>
<queue name="ExpiryQueue"/>
<queue name="NewQueue"/>
<queue name="DivertQueue"/>
</jms>
@ -83,6 +84,13 @@ under the License.
</acceptors>
<diverts>
<divert name="myDivert">
<address>jms.queue.DivertQueue</address>
<forwarding-address>jms.queue.NewQueue</forwarding-address>
</divert>
</diverts>
<security-settings>
<security-setting match="#">