use of org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException in project activemq-artemis by apache.
the class AMQPSessionCallback method bindingQuery.
public boolean bindingQuery(SimpleString address, RoutingType routingType) throws Exception {
BindingQueryResult bindingQueryResult = bindingQueryCache.getResult(address);
if (bindingQueryResult != null) {
return bindingQueryResult.isExists();
}
bindingQueryResult = serverSession.executeBindingQuery(address);
if (routingType == RoutingType.MULTICAST && !bindingQueryResult.isExists() && bindingQueryResult.isAutoCreateAddresses()) {
try {
serverSession.createAddress(address, routingType, true);
} catch (ActiveMQAddressExistsException e) {
// The address may have been created by another thread in the mean time. Catch and do nothing.
}
bindingQueryResult = serverSession.executeBindingQuery(address);
} else if (routingType == RoutingType.ANYCAST && bindingQueryResult.isAutoCreateQueues()) {
QueueQueryResult queueBinding = serverSession.executeQueueQuery(address);
if (!queueBinding.isExists()) {
try {
serverSession.createQueue(address, address, routingType, null, false, true, true);
} catch (ActiveMQQueueExistsException e) {
// The queue may have been created by another thread in the mean time. Catch and do nothing.
}
}
bindingQueryResult = serverSession.executeBindingQuery(address);
}
bindingQueryCache.setResult(address, bindingQueryResult);
return bindingQueryResult.isExists();
}
Aggregations