ARTEMIS-3771 Avoid not needed lookup for address on OpenWire connections
This commit is contained in:
parent
97b4f6a578
commit
84e68c76e9
|
@ -66,7 +66,8 @@ import org.apache.activemq.artemis.core.security.SecurityAuth;
|
|||
import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle;
|
||||
import org.apache.activemq.artemis.core.server.ActiveMQServer;
|
||||
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
|
||||
import org.apache.activemq.artemis.core.server.BindingQueryResult;
|
||||
import org.apache.activemq.artemis.core.server.AddressQueryResult;
|
||||
import org.apache.activemq.artemis.core.server.QueueQueryResult;
|
||||
import org.apache.activemq.artemis.core.server.MessageReference;
|
||||
import org.apache.activemq.artemis.core.server.ServerConsumer;
|
||||
import org.apache.activemq.artemis.core.server.ServerSession;
|
||||
|
@ -1149,8 +1150,10 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se
|
|||
private void validateDestination(ActiveMQDestination destination) throws Exception {
|
||||
if (destination.isQueue()) {
|
||||
SimpleString physicalName = new SimpleString(destination.getPhysicalName());
|
||||
BindingQueryResult result = server.bindingQuery(physicalName);
|
||||
if (!result.isExists() && !result.isAutoCreateQueues()) {
|
||||
QueueQueryResult queue = server.queueQuery(physicalName);
|
||||
AddressQueryResult address = server.addressQuery(physicalName);
|
||||
|
||||
if (!address.isExists() && !queue.isAutoCreateQueues()) {
|
||||
throw ActiveMQMessageBundle.BUNDLE.noSuchQueue(physicalName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,12 +41,12 @@ import org.apache.activemq.artemis.core.protocol.openwire.OpenWireProtocolManage
|
|||
import org.apache.activemq.artemis.core.protocol.openwire.util.OpenWireUtil;
|
||||
import org.apache.activemq.artemis.core.server.ActiveMQServer;
|
||||
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
|
||||
import org.apache.activemq.artemis.core.server.BindingQueryResult;
|
||||
import org.apache.activemq.artemis.core.server.MessageReference;
|
||||
import org.apache.activemq.artemis.core.server.QueueQueryResult;
|
||||
import org.apache.activemq.artemis.core.server.ServerConsumer;
|
||||
import org.apache.activemq.artemis.core.server.ServerSession;
|
||||
import org.apache.activemq.artemis.core.server.SlowConsumerDetectionListener;
|
||||
import org.apache.activemq.artemis.core.server.impl.AddressInfo;
|
||||
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
|
||||
import org.apache.activemq.artemis.reader.MessageUtil;
|
||||
import org.apache.activemq.artemis.spi.core.protocol.SessionCallback;
|
||||
|
@ -225,23 +225,23 @@ public class AMQSession implements SessionCallback {
|
|||
}
|
||||
|
||||
private boolean checkAutoCreateQueue(SimpleString queueName, boolean isTemporary, String filter) throws Exception {
|
||||
|
||||
boolean hasQueue = true;
|
||||
if (!connection.containsKnownDestination(queueName)) {
|
||||
|
||||
BindingQueryResult bindingQuery = server.bindingQuery(queueName);
|
||||
QueueQueryResult queueBinding = server.queueQuery(queueName);
|
||||
QueueQueryResult queueQuery = server.queueQuery(queueName);
|
||||
|
||||
try {
|
||||
if (!queueBinding.isExists()) {
|
||||
if (bindingQuery.isAutoCreateQueues()) {
|
||||
if (!queueQuery.isExists()) {
|
||||
if (queueQuery.isAutoCreateQueues()) {
|
||||
SimpleString queueNameToUse = queueName;
|
||||
SimpleString addressToUse = queueName;
|
||||
RoutingType routingTypeToUse = RoutingType.ANYCAST;
|
||||
if (CompositeAddress.isFullyQualified(queueName.toString())) {
|
||||
addressToUse = CompositeAddress.extractAddressName(queueName);
|
||||
queueNameToUse = CompositeAddress.extractQueueName(queueName);
|
||||
if (bindingQuery.getAddressInfo() != null) {
|
||||
routingTypeToUse = bindingQuery.getAddressInfo().getRoutingType();
|
||||
AddressInfo addressInfo = server.getAddressInfo(addressToUse);
|
||||
if (addressInfo != null) {
|
||||
routingTypeToUse = addressInfo.getRoutingType();
|
||||
} else {
|
||||
AddressSettings as = server.getAddressSettingsRepository().getMatch(addressToUse.toString());
|
||||
routingTypeToUse = as.getDefaultAddressRoutingType();
|
||||
|
@ -257,7 +257,6 @@ public class AMQSession implements SessionCallback {
|
|||
// In case another thread created the queue before us but after we did the binding query
|
||||
hasQueue = true;
|
||||
}
|
||||
|
||||
}
|
||||
return hasQueue;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue