ARTEMIS-885 Fix OpenWire wildcard conversion issue

This commit is contained in:
Howard Gao 2016-12-13 12:20:45 +08:00 committed by Clebert Suconic
parent 656eee79e4
commit d67ea071a3
4 changed files with 16 additions and 3 deletions

View File

@ -97,7 +97,7 @@ public class AMQConsumer {
serverConsumer = session.getCoreSession().createConsumer(nativeId, queueName, null, info.isBrowser(), false, -1); serverConsumer = session.getCoreSession().createConsumer(nativeId, queueName, null, info.isBrowser(), false, -1);
serverConsumer.setlowConsumerDetection(slowConsumerDetectionListener); serverConsumer.setlowConsumerDetection(slowConsumerDetectionListener);
} else { } else {
SimpleString queueName = new SimpleString(openwireDestination.getPhysicalName()); SimpleString queueName = new SimpleString(OpenWireUtil.convertWildcard(openwireDestination.getPhysicalName()));
try { try {
session.getCoreServer().createQueue(queueName, RoutingType.ANYCAST, queueName, null, true, false); session.getCoreServer().createQueue(queueName, RoutingType.ANYCAST, queueName, null, true, false);
} catch (ActiveMQQueueExistsException e) { } catch (ActiveMQQueueExistsException e) {

View File

@ -29,6 +29,7 @@ import org.apache.activemq.artemis.core.postoffice.RoutingStatus;
import org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection; import org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection;
import org.apache.activemq.artemis.core.protocol.openwire.OpenWireMessageConverter; import org.apache.activemq.artemis.core.protocol.openwire.OpenWireMessageConverter;
import org.apache.activemq.artemis.core.protocol.openwire.OpenWireProtocolManager; import org.apache.activemq.artemis.core.protocol.openwire.OpenWireProtocolManager;
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.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.apache.activemq.artemis.core.server.BindingQueryResult; import org.apache.activemq.artemis.core.server.BindingQueryResult;
@ -150,7 +151,7 @@ public class AMQSession implements SessionCallback {
for (ActiveMQDestination openWireDest : dests) { for (ActiveMQDestination openWireDest : dests) {
if (openWireDest.isQueue()) { if (openWireDest.isQueue()) {
SimpleString queueName = new SimpleString(openWireDest.getPhysicalName()); SimpleString queueName = new SimpleString(OpenWireUtil.convertWildcard(openWireDest.getPhysicalName()));
if (!checkAutoCreateQueue(queueName, openWireDest.isTemporary())) { if (!checkAutoCreateQueue(queueName, openWireDest.isTemporary())) {
throw new InvalidDestinationException("Destination doesn't exist: " + queueName); throw new InvalidDestinationException("Destination doesn't exist: " + queueName);

View File

@ -64,7 +64,7 @@ public class OpenWireTestBase extends ActiveMQTestBase {
Configuration serverConfig = server.getConfiguration(); Configuration serverConfig = server.getConfiguration();
serverConfig.getAddressesSettings().put("#", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ"))); serverConfig.getAddressesSettings().put("#", new AddressSettings().setAutoCreateQueues(false).setAutoCreateAddresses(false).setDeadLetterAddress(new SimpleString("ActiveMQ.DLQ")).setAutoCreateAddresses(true));
serverConfig.setSecurityEnabled(enableSecurity); serverConfig.setSecurityEnabled(enableSecurity);

View File

@ -16,6 +16,9 @@
*/ */
package org.apache.activemq.artemis.tests.integration.openwire.amq; package org.apache.activemq.artemis.tests.integration.openwire.amq;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import javax.jms.DeliveryMode; import javax.jms.DeliveryMode;
/** /**
@ -39,4 +42,13 @@ public class JmsDurableQueueWildcardSendReceiveTest extends JmsTopicSendReceiveT
protected String getProducerSubject() { protected String getProducerSubject() {
return "FOO.BAR.HUMBUG"; return "FOO.BAR.HUMBUG";
} }
@Override
protected void extraServerConfig(Configuration serverConfig) {
AddressSettings settings = serverConfig.getAddressesSettings().get("#");
if (settings != null) {
settings.setAutoCreateQueues(true);
}
}
} }