This closes #498 ARTEMIS-510 create queue only on route
This commit is contained in:
commit
7d0d779990
|
@ -298,13 +298,8 @@ public class ActiveMQSession implements QueueSession, TopicSession {
|
|||
if (jbd != null) {
|
||||
ClientSession.AddressQuery response = session.addressQuery(jbd.getSimpleAddress());
|
||||
|
||||
if (!response.isExists()) {
|
||||
if (response.isAutoCreateJmsQueues()) {
|
||||
session.createQueue(jbd.getSimpleAddress(), jbd.getSimpleAddress(), true);
|
||||
}
|
||||
else {
|
||||
throw new InvalidDestinationException("Destination " + jbd.getName() + " does not exist");
|
||||
}
|
||||
if (!response.isExists() && !response.isAutoCreateJmsQueues()) {
|
||||
throw new InvalidDestinationException("Destination " + jbd.getName() + " does not exist");
|
||||
}
|
||||
|
||||
connection.addKnownDestination(jbd.getSimpleAddress());
|
||||
|
|
|
@ -66,6 +66,9 @@ public class AutoCreateJmsQueueTest extends JMSTestBase {
|
|||
}
|
||||
|
||||
connection.close();
|
||||
|
||||
// make sure the JMX control was created for the JMS queue
|
||||
assertNotNull(server.getManagementService().getResource("jms.queue.test"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -110,10 +113,12 @@ public class AutoCreateJmsQueueTest extends JMSTestBase {
|
|||
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
|
||||
javax.jms.Queue queue = ActiveMQJMSClient.createQueue("test");
|
||||
MessageProducer producer = session.createProducer(queue);
|
||||
TextMessage mess = session.createTextMessage("msg");
|
||||
|
||||
try {
|
||||
MessageProducer producer = session.createProducer(queue);
|
||||
Assert.fail("Creating a producer here should throw a JMSSecurityException");
|
||||
producer.send(mess);
|
||||
Assert.fail("Sending a message here should throw a JMSSecurityException");
|
||||
}
|
||||
catch (Exception e) {
|
||||
Assert.assertTrue(e instanceof JMSSecurityException);
|
||||
|
|
Loading…
Reference in New Issue