This closes #1153
This commit is contained in:
commit
9b11914c21
|
@ -23,6 +23,7 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
import org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException;
|
||||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||||
import org.apache.activemq.artemis.core.paging.PagingStore;
|
import org.apache.activemq.artemis.core.paging.PagingStore;
|
||||||
|
@ -176,16 +177,20 @@ public class AMQSession implements SessionCallback {
|
||||||
BindingQueryResult bindingQuery = server.bindingQuery(queueName);
|
BindingQueryResult bindingQuery = server.bindingQuery(queueName);
|
||||||
QueueQueryResult queueBinding = server.queueQuery(queueName);
|
QueueQueryResult queueBinding = server.queueQuery(queueName);
|
||||||
|
|
||||||
boolean isAutoCreate = bindingQuery.isExists() ? true : bindingQuery.isAutoCreateQueues();
|
try {
|
||||||
|
if (!queueBinding.isExists()) {
|
||||||
if (!queueBinding.isExists()) {
|
if (bindingQuery.isAutoCreateQueues()) {
|
||||||
if (isAutoCreate) {
|
server.createQueue(queueName, RoutingType.ANYCAST, queueName, null, true, isTemporary);
|
||||||
server.createQueue(queueName, RoutingType.ANYCAST, queueName, null, true, isTemporary);
|
connection.addKnownDestination(queueName);
|
||||||
connection.addKnownDestination(queueName);
|
} else {
|
||||||
} else {
|
hasQueue = false;
|
||||||
hasQueue = false;
|
}
|
||||||
}
|
}
|
||||||
|
} catch (ActiveMQQueueExistsException e) {
|
||||||
|
// In case another thread created the queue before us but after we did the binding query
|
||||||
|
hasQueue = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return hasQueue;
|
return hasQueue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue