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) {
|
if (jbd != null) {
|
||||||
ClientSession.AddressQuery response = session.addressQuery(jbd.getSimpleAddress());
|
ClientSession.AddressQuery response = session.addressQuery(jbd.getSimpleAddress());
|
||||||
|
|
||||||
if (!response.isExists()) {
|
if (!response.isExists() && !response.isAutoCreateJmsQueues()) {
|
||||||
if (response.isAutoCreateJmsQueues()) {
|
throw new InvalidDestinationException("Destination " + jbd.getName() + " does not exist");
|
||||||
session.createQueue(jbd.getSimpleAddress(), jbd.getSimpleAddress(), true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new InvalidDestinationException("Destination " + jbd.getName() + " does not exist");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
connection.addKnownDestination(jbd.getSimpleAddress());
|
connection.addKnownDestination(jbd.getSimpleAddress());
|
||||||
|
|
|
@ -66,6 +66,9 @@ public class AutoCreateJmsQueueTest extends JMSTestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
connection.close();
|
connection.close();
|
||||||
|
|
||||||
|
// make sure the JMX control was created for the JMS queue
|
||||||
|
assertNotNull(server.getManagementService().getResource("jms.queue.test"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -110,10 +113,12 @@ public class AutoCreateJmsQueueTest extends JMSTestBase {
|
||||||
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||||
|
|
||||||
javax.jms.Queue queue = ActiveMQJMSClient.createQueue("test");
|
javax.jms.Queue queue = ActiveMQJMSClient.createQueue("test");
|
||||||
|
MessageProducer producer = session.createProducer(queue);
|
||||||
|
TextMessage mess = session.createTextMessage("msg");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
MessageProducer producer = session.createProducer(queue);
|
producer.send(mess);
|
||||||
Assert.fail("Creating a producer here should throw a JMSSecurityException");
|
Assert.fail("Sending a message here should throw a JMSSecurityException");
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Assert.assertTrue(e instanceof JMSSecurityException);
|
Assert.assertTrue(e instanceof JMSSecurityException);
|
||||||
|
|
Loading…
Reference in New Issue