diff --git a/docs/src/main/asciidoc/_admin-guide/subsystem-configuration/Messaging_Connect_a_pooled-connection-factory_to_a_Remote_Artemis_Server.adoc b/docs/src/main/asciidoc/_admin-guide/subsystem-configuration/Messaging_Connect_a_pooled-connection-factory_to_a_Remote_Artemis_Server.adoc index a33dfb4acd72..18d39f3c7ce5 100644 --- a/docs/src/main/asciidoc/_admin-guide/subsystem-configuration/Messaging_Connect_a_pooled-connection-factory_to_a_Remote_Artemis_Server.adoc +++ b/docs/src/main/asciidoc/_admin-guide/subsystem-configuration/Messaging_Connect_a_pooled-connection-factory_to_a_Remote_Artemis_Server.adoc @@ -32,6 +32,15 @@ created at step (2). /subsystem=messaging-activemq/pooled-connection-factory=remote-artemis:add(connectors=[remote-artemis], entries=[java:/jms/remoteCF]) ---- +In Artemis 1.x topics and queues used had a prefix(jms.topic. and jms.queue.) that were prepended to the destination name. +In Artemis 2.x this is no longer the case, but for compatibility reasons WildFly still prepend those prefixes and tells Artemis to run in compatibility mode. +If you are connecting to a remote Artemis 2.x, it may not be in compatibility mode and thus the old prefixes may not be used anymore. +If you need to use destinations without those prefixes, you can configure your connection factory not to use them by setting the attribute `enable-amq1-prefix` to false. +[source,options="nowrap"] +---- +/subsystem=messaging-activemq/pooled-connection-factory=remote-artemis:write-attribute(name="enable-amq1-prefix", value="false") +---- + [[configuration-of-a-mdb-using-a-pooled-connection-factory]] == JMS Queues and Topics on a remote Artemis Server diff --git a/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/MessagingSubsystemParser_7_0.java b/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/MessagingSubsystemParser_7_0.java index f3c60530bdce..4a4364f61684 100644 --- a/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/MessagingSubsystemParser_7_0.java +++ b/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/MessagingSubsystemParser_7_0.java @@ -19,7 +19,6 @@ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ - package org.wildfly.extension.messaging.activemq; import static org.jboss.as.controller.PathElement.pathElement; @@ -61,7 +60,7 @@ public class MessagingSubsystemParser_7_0 extends PersistentResourceXMLParser { static final String NAMESPACE = "urn:jboss:domain:messaging-activemq:7.0"; @Override - public PersistentResourceXMLDescription getParserDescription(){ + public PersistentResourceXMLDescription getParserDescription() { final PersistentResourceXMLBuilder discoveryGroup = builder(DiscoveryGroupDefinition.PATH) .addAttributes( @@ -95,71 +94,6 @@ public PersistentResourceXMLDescription getParserDescription(){ CommonAttributes.FACTORY_CLASS, CommonAttributes.PARAMS); - final PersistentResourceXMLBuilder pooledConnectionFactory = - builder(MessagingExtension.POOLED_CONNECTION_FACTORY_PATH) - .addAttributes( - ConnectionFactoryAttributes.Common.ENTRIES, - // common - ConnectionFactoryAttributes.Common.DISCOVERY_GROUP, - ConnectionFactoryAttributes.Common.CONNECTORS, - CommonAttributes.HA, - ConnectionFactoryAttributes.Common.CLIENT_FAILURE_CHECK_PERIOD, - ConnectionFactoryAttributes.Common.CONNECTION_TTL, - CommonAttributes.CALL_TIMEOUT, - CommonAttributes.CALL_FAILOVER_TIMEOUT, - ConnectionFactoryAttributes.Common.CONSUMER_WINDOW_SIZE, - ConnectionFactoryAttributes.Common.CONSUMER_MAX_RATE, - ConnectionFactoryAttributes.Common.CONFIRMATION_WINDOW_SIZE, - ConnectionFactoryAttributes.Common.PRODUCER_WINDOW_SIZE, - ConnectionFactoryAttributes.Common.PRODUCER_MAX_RATE, - ConnectionFactoryAttributes.Common.PROTOCOL_MANAGER_FACTORY, - ConnectionFactoryAttributes.Common.COMPRESS_LARGE_MESSAGES, - ConnectionFactoryAttributes.Common.CACHE_LARGE_MESSAGE_CLIENT, - CommonAttributes.MIN_LARGE_MESSAGE_SIZE, - CommonAttributes.CLIENT_ID, - ConnectionFactoryAttributes.Common.DUPS_OK_BATCH_SIZE, - ConnectionFactoryAttributes.Common.TRANSACTION_BATCH_SIZE, - ConnectionFactoryAttributes.Common.BLOCK_ON_ACKNOWLEDGE, - ConnectionFactoryAttributes.Common.BLOCK_ON_NON_DURABLE_SEND, - ConnectionFactoryAttributes.Common.BLOCK_ON_DURABLE_SEND, - ConnectionFactoryAttributes.Common.AUTO_GROUP, - ConnectionFactoryAttributes.Common.PRE_ACKNOWLEDGE, - ConnectionFactoryAttributes.Common.RETRY_INTERVAL, - ConnectionFactoryAttributes.Common.RETRY_INTERVAL_MULTIPLIER, - CommonAttributes.MAX_RETRY_INTERVAL, - ConnectionFactoryAttributes.Common.RECONNECT_ATTEMPTS, - ConnectionFactoryAttributes.Common.FAILOVER_ON_INITIAL_CONNECTION, - ConnectionFactoryAttributes.Common.CONNECTION_LOAD_BALANCING_CLASS_NAME, - ConnectionFactoryAttributes.Common.USE_GLOBAL_POOLS, - ConnectionFactoryAttributes.Common.SCHEDULED_THREAD_POOL_MAX_SIZE, - ConnectionFactoryAttributes.Common.THREAD_POOL_MAX_SIZE, - ConnectionFactoryAttributes.Common.GROUP_ID, - ConnectionFactoryAttributes.Common.DESERIALIZATION_BLACKLIST, - ConnectionFactoryAttributes.Common.DESERIALIZATION_WHITELIST, - // pooled - // inbound config - ConnectionFactoryAttributes.Pooled.USE_JNDI, - ConnectionFactoryAttributes.Pooled.JNDI_PARAMS, - ConnectionFactoryAttributes.Pooled.REBALANCE_CONNECTIONS, - ConnectionFactoryAttributes.Pooled.USE_LOCAL_TX, - ConnectionFactoryAttributes.Pooled.SETUP_ATTEMPTS, - ConnectionFactoryAttributes.Pooled.SETUP_INTERVAL, - // outbound config - ConnectionFactoryAttributes.Pooled.ALLOW_LOCAL_TRANSACTIONS, - - ConnectionFactoryAttributes.Pooled.TRANSACTION, - ConnectionFactoryAttributes.Pooled.USER, - ConnectionFactoryAttributes.Pooled.PASSWORD, - ConnectionFactoryAttributes.Pooled.CREDENTIAL_REFERENCE, - ConnectionFactoryAttributes.Pooled.MIN_POOL_SIZE, - ConnectionFactoryAttributes.Pooled.USE_AUTO_RECOVERY, - ConnectionFactoryAttributes.Pooled.MAX_POOL_SIZE, - ConnectionFactoryAttributes.Pooled.MANAGED_CONNECTION_POOL, - ConnectionFactoryAttributes.Pooled.ENLISTMENT_TRACE, - ConnectionFactoryAttributes.Common.INITIAL_MESSAGE_PACKET_SIZE, - ConnectionFactoryAttributes.Pooled.INITIAL_CONNECT_ATTEMPTS, - ConnectionFactoryAttributes.Pooled.STATISTICS_ENABLED); - return builder(MessagingExtension.SUBSYSTEM_PATH, NAMESPACE) .addAttributes( MessagingSubsystemRootResourceDefinition.GLOBAL_CLIENT_THREAD_POOL_MAX_SIZE, @@ -175,17 +109,18 @@ public PersistentResourceXMLDescription getParserDescription(){ ConnectionFactoryAttributes.Regular.FACTORY_TYPE, ConnectionFactoryAttributes.Common.DISCOVERY_GROUP, ConnectionFactoryAttributes.Common.CONNECTORS, - ConnectionFactoryAttributes.Common.ENTRIES - )) - .addChild(pooledConnectionFactory) + ConnectionFactoryAttributes.Common.ENTRIES, + ConnectionFactoryAttributes.External.ENABLE_AMQ1_PREFIX + )) + .addChild(createPooledConnectionFactory(true)) .addChild(builder(MessagingExtension.EXTERNAL_JMS_QUEUE_PATH) .addAttributes( ConnectionFactoryAttributes.Common.ENTRIES - )) + )) .addChild(builder(MessagingExtension.EXTERNAL_JMS_TOPIC_PATH) .addAttributes( ConnectionFactoryAttributes.Common.ENTRIES - )) + )) .addChild( builder(MessagingExtension.SERVER_PATH) .addAttributes(// no attribute groups @@ -628,7 +563,7 @@ public PersistentResourceXMLDescription getParserDescription(){ LegacyConnectionFactoryDefinition.THREAD_POOL_MAX_SIZE, LegacyConnectionFactoryDefinition.TRANSACTION_BATCH_SIZE, LegacyConnectionFactoryDefinition.USE_GLOBAL_POOLS)) - .addChild(pooledConnectionFactory)) + .addChild(createPooledConnectionFactory(false))) .addChild( builder(JMSBridgeDefinition.INSTANCE.getPathElement()) .addAttributes( @@ -657,4 +592,73 @@ public PersistentResourceXMLDescription getParserDescription(){ .build(); } + private PersistentResourceXMLBuilder createPooledConnectionFactory(boolean external) { + PersistentResourceXMLBuilder builder = builder(MessagingExtension.POOLED_CONNECTION_FACTORY_PATH) + .addAttributes( + ConnectionFactoryAttributes.Common.ENTRIES, + // common + ConnectionFactoryAttributes.Common.DISCOVERY_GROUP, + ConnectionFactoryAttributes.Common.CONNECTORS, + CommonAttributes.HA, + ConnectionFactoryAttributes.Common.CLIENT_FAILURE_CHECK_PERIOD, + ConnectionFactoryAttributes.Common.CONNECTION_TTL, + CommonAttributes.CALL_TIMEOUT, + CommonAttributes.CALL_FAILOVER_TIMEOUT, + ConnectionFactoryAttributes.Common.CONSUMER_WINDOW_SIZE, + ConnectionFactoryAttributes.Common.CONSUMER_MAX_RATE, + ConnectionFactoryAttributes.Common.CONFIRMATION_WINDOW_SIZE, + ConnectionFactoryAttributes.Common.PRODUCER_WINDOW_SIZE, + ConnectionFactoryAttributes.Common.PRODUCER_MAX_RATE, + ConnectionFactoryAttributes.Common.PROTOCOL_MANAGER_FACTORY, + ConnectionFactoryAttributes.Common.COMPRESS_LARGE_MESSAGES, + ConnectionFactoryAttributes.Common.CACHE_LARGE_MESSAGE_CLIENT, + CommonAttributes.MIN_LARGE_MESSAGE_SIZE, + CommonAttributes.CLIENT_ID, + ConnectionFactoryAttributes.Common.DUPS_OK_BATCH_SIZE, + ConnectionFactoryAttributes.Common.TRANSACTION_BATCH_SIZE, + ConnectionFactoryAttributes.Common.BLOCK_ON_ACKNOWLEDGE, + ConnectionFactoryAttributes.Common.BLOCK_ON_NON_DURABLE_SEND, + ConnectionFactoryAttributes.Common.BLOCK_ON_DURABLE_SEND, + ConnectionFactoryAttributes.Common.AUTO_GROUP, + ConnectionFactoryAttributes.Common.PRE_ACKNOWLEDGE, + ConnectionFactoryAttributes.Common.RETRY_INTERVAL, + ConnectionFactoryAttributes.Common.RETRY_INTERVAL_MULTIPLIER, + CommonAttributes.MAX_RETRY_INTERVAL, + ConnectionFactoryAttributes.Common.RECONNECT_ATTEMPTS, + ConnectionFactoryAttributes.Common.FAILOVER_ON_INITIAL_CONNECTION, + ConnectionFactoryAttributes.Common.CONNECTION_LOAD_BALANCING_CLASS_NAME, + ConnectionFactoryAttributes.Common.USE_GLOBAL_POOLS, + ConnectionFactoryAttributes.Common.SCHEDULED_THREAD_POOL_MAX_SIZE, + ConnectionFactoryAttributes.Common.THREAD_POOL_MAX_SIZE, + ConnectionFactoryAttributes.Common.GROUP_ID, + ConnectionFactoryAttributes.Common.DESERIALIZATION_BLACKLIST, + ConnectionFactoryAttributes.Common.DESERIALIZATION_WHITELIST, + // pooled + // inbound config + ConnectionFactoryAttributes.Pooled.USE_JNDI, + ConnectionFactoryAttributes.Pooled.JNDI_PARAMS, + ConnectionFactoryAttributes.Pooled.REBALANCE_CONNECTIONS, + ConnectionFactoryAttributes.Pooled.USE_LOCAL_TX, + ConnectionFactoryAttributes.Pooled.SETUP_ATTEMPTS, + ConnectionFactoryAttributes.Pooled.SETUP_INTERVAL, + // outbound config + ConnectionFactoryAttributes.Pooled.ALLOW_LOCAL_TRANSACTIONS, + ConnectionFactoryAttributes.Pooled.TRANSACTION, + ConnectionFactoryAttributes.Pooled.USER, + ConnectionFactoryAttributes.Pooled.PASSWORD, + ConnectionFactoryAttributes.Pooled.CREDENTIAL_REFERENCE, + ConnectionFactoryAttributes.Pooled.MIN_POOL_SIZE, + ConnectionFactoryAttributes.Pooled.USE_AUTO_RECOVERY, + ConnectionFactoryAttributes.Pooled.MAX_POOL_SIZE, + ConnectionFactoryAttributes.Pooled.MANAGED_CONNECTION_POOL, + ConnectionFactoryAttributes.Pooled.ENLISTMENT_TRACE, + ConnectionFactoryAttributes.Common.INITIAL_MESSAGE_PACKET_SIZE, + ConnectionFactoryAttributes.Pooled.INITIAL_CONNECT_ATTEMPTS, + ConnectionFactoryAttributes.Pooled.STATISTICS_ENABLED); + if (external) { + builder.addAttributes(ConnectionFactoryAttributes.External.ENABLE_AMQ1_PREFIX); + } + return builder; + } + } diff --git a/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/MessagingTransformerRegistration.java b/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/MessagingTransformerRegistration.java index 06abb50b48d2..5bb0947dd1a2 100644 --- a/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/MessagingTransformerRegistration.java +++ b/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/MessagingTransformerRegistration.java @@ -84,6 +84,9 @@ public void registerTransformers(SubsystemTransformerRegistration registration) private static void registerTransformers_WF_17(ResourceTransformationDescriptionBuilder subsystem) { ResourceTransformationDescriptionBuilder server = subsystem.addChildResource(SERVER_PATH); rejectDefinedAttributeWithDefaultValue(server, ServerDefinition.JOURNAL_FILE_OPEN_TIMEOUT); + + rejectDefinedAttributeWithDefaultValue(subsystem.addChildResource(PathElement.pathElement(CONNECTION_FACTORY)), ConnectionFactoryAttributes.External.ENABLE_AMQ1_PREFIX); + rejectDefinedAttributeWithDefaultValue(subsystem.addChildResource(PathElement.pathElement(POOLED_CONNECTION_FACTORY)), ConnectionFactoryAttributes.External.ENABLE_AMQ1_PREFIX); } private static void registerTransformers_WF_16(ResourceTransformationDescriptionBuilder subsystem) { diff --git a/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/ConnectionFactoryAttributes.java b/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/ConnectionFactoryAttributes.java index 234beb9ddc58..6daab3d59d3c 100644 --- a/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/ConnectionFactoryAttributes.java +++ b/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/ConnectionFactoryAttributes.java @@ -668,6 +668,18 @@ public ModelNode correct(ModelNode newValue, ModelNode currentValue) { }; } + interface External { + AttributeDefinition ENABLE_AMQ1_PREFIX = create("enable-amq1-prefix", BOOLEAN) + .setDefaultValue(new ModelNode(true)) + .setValidator(ConnectionFactoryType.VALIDATOR) + .setRequired(false) + .setAllowExpression(true) + .setRestartAllServices() + .build(); + + AttributeDefinition[] ATTRIBUTES = { ENABLE_AMQ1_PREFIX } ; + + } static class TransactionNameAllowedValuesValidator extends StringAllowedValuesValidator { public TransactionNameAllowedValuesValidator(String... values) { super(values); diff --git a/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/ExternalConnectionFactoryAdd.java b/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/ExternalConnectionFactoryAdd.java index a85244aebd51..c7a168472f4a 100644 --- a/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/ExternalConnectionFactoryAdd.java +++ b/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/ExternalConnectionFactoryAdd.java @@ -55,6 +55,8 @@ import org.wildfly.extension.messaging.activemq.jms.ConnectionFactoryAttributes.Common; import org.wildfly.extension.messaging.activemq.logging.MessagingLogger; +import static org.wildfly.extension.messaging.activemq.jms.ConnectionFactoryAttributes.External.ENABLE_AMQ1_PREFIX; + /** * Update adding a connection factory to the subsystem. The * runtime action will create the {@link ExternalConnectionFactoryService}. @@ -75,6 +77,7 @@ protected void performRuntime(OperationContext context, ModelNode operation, Mod final String name = context.getCurrentAddressValue(); final ServiceName serviceName = ExternalConnectionFactoryDefinition.CAPABILITY.getCapabilityServiceName(context.getCurrentAddress()); boolean ha = HA.resolveModelAttribute(context, model).asBoolean(); + boolean enable1Prefixes = ENABLE_AMQ1_PREFIX.resolveModelAttribute(context, model).asBoolean(); final ModelNode discoveryGroupName = Common.DISCOVERY_GROUP.resolveModelAttribute(context, model); JMSFactoryType jmsFactoryType = ConnectionFactoryType.valueOf(ConnectionFactoryAttributes.Regular.FACTORY_TYPE.resolveModelAttribute(context, model).asString()).getType(); List connectorNames = Common.CONNECTORS.unwrap(context, model); @@ -104,7 +107,7 @@ protected void performRuntime(OperationContext context, ModelNode operation, Mod Supplier groupBindingSupplier = builder.requires(groupBinding); groupBindings.put(key, groupBindingSupplier); } - service = new ExternalConnectionFactoryService(getDiscoveryGroup(context, dgname), commandDispatcherFactories, groupBindings, clusterNames, jmsFactoryType, ha); + service = new ExternalConnectionFactoryService(getDiscoveryGroup(context, dgname), commandDispatcherFactories, groupBindings, clusterNames, jmsFactoryType, ha, enable1Prefixes); } else { Map> socketBindings = new HashMap<>(); Map> outboundSocketBindings = new HashMap<>(); @@ -123,7 +126,7 @@ protected void performRuntime(OperationContext context, ModelNode operation, Mod socketBindings.put(connectorSocketBinding, socketBindingsSupplier); } } - service = new ExternalConnectionFactoryService(transportConfigurations, socketBindings, outboundSocketBindings, jmsFactoryType, ha); + service = new ExternalConnectionFactoryService(transportConfigurations, socketBindings, outboundSocketBindings, jmsFactoryType, ha, enable1Prefixes); } builder.setInstance(service); builder.install(); diff --git a/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/ExternalConnectionFactoryDefinition.java b/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/ExternalConnectionFactoryDefinition.java index f8543cda6ff7..90f208003a54 100644 --- a/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/ExternalConnectionFactoryDefinition.java +++ b/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/ExternalConnectionFactoryDefinition.java @@ -30,6 +30,7 @@ import org.wildfly.extension.messaging.activemq.CommonAttributes; import org.wildfly.extension.messaging.activemq.MessagingExtension; import org.wildfly.extension.messaging.activemq.jms.ConnectionFactoryAttributes.Common; +import org.wildfly.extension.messaging.activemq.jms.ConnectionFactoryAttributes.External; import org.wildfly.extension.messaging.activemq.jms.ConnectionFactoryAttributes.Regular; /** @@ -45,7 +46,7 @@ public class ExternalConnectionFactoryDefinition extends PersistentResourceDefin static final RuntimeCapability CAPABILITY = RuntimeCapability.Builder.of("org.wildfly.messaging.activemq.external.connection-factory", true, ExternalConnectionFactoryService.class). build(); public static final AttributeDefinition[] ATTRIBUTES = new AttributeDefinition[]{ - CommonAttributes.HA, Regular.FACTORY_TYPE, Common.DISCOVERY_GROUP, CONNECTORS, Common.ENTRIES}; + CommonAttributes.HA, Regular.FACTORY_TYPE, Common.DISCOVERY_GROUP, CONNECTORS, Common.ENTRIES, External.ENABLE_AMQ1_PREFIX}; private final boolean registerRuntimeOnly; diff --git a/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/ExternalConnectionFactoryService.java b/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/ExternalConnectionFactoryService.java index 46ea72890cac..b307716495b2 100644 --- a/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/ExternalConnectionFactoryService.java +++ b/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/ExternalConnectionFactoryService.java @@ -44,6 +44,7 @@ public class ExternalConnectionFactoryService implements Service { private final boolean ha; + private final boolean enable1Prefixes; private final DiscoveryGroupConfiguration groupConfiguration; private final TransportConfiguration[] connectors; private final JMSFactoryType type; @@ -59,16 +60,17 @@ public class ExternalConnectionFactoryService implements Service> commandDispatcherFactories, - Map> groupBindings, Map clusterNames, JMSFactoryType type, boolean ha) { - this(ha, type, groupConfiguration, Collections.emptyMap(), Collections.emptyMap(),commandDispatcherFactories, groupBindings, clusterNames, null); + Map> groupBindings, Map clusterNames, JMSFactoryType type, boolean ha, boolean enable1Prefixes) { + this(ha, enable1Prefixes, type, groupConfiguration, Collections.emptyMap(), Collections.emptyMap(),commandDispatcherFactories, groupBindings, clusterNames, null); } ExternalConnectionFactoryService(TransportConfiguration[] connectors, Map> socketBindings, - Map> outboundSocketBindings, JMSFactoryType type, boolean ha) { - this(ha, type, null, socketBindings, outboundSocketBindings, Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), connectors); + Map> outboundSocketBindings, JMSFactoryType type, boolean ha, boolean enable1Prefixes) { + this(ha, enable1Prefixes, type, null, socketBindings, outboundSocketBindings, Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), connectors); } private ExternalConnectionFactoryService(boolean ha, + boolean enable1Prefixes, JMSFactoryType type, DiscoveryGroupConfiguration groupConfiguration, Map> socketBindings, @@ -79,6 +81,7 @@ private ExternalConnectionFactoryService(boolean ha, TransportConfiguration[] connectors) { assert (connectors != null && connectors.length > 0) || groupConfiguration != null; this.ha = ha; + this.enable1Prefixes = enable1Prefixes; this.type = type; this.groupConfiguration = groupConfiguration; this.connectors = connectors; @@ -121,6 +124,7 @@ public void start(StartContext context) throws StartException { factory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(config, type); } } + factory.setEnable1xPrefixes(enable1Prefixes); } catch (Throwable e) { throw MessagingLogger.ROOT_LOGGER.failedToCreate(e, "connection-factory"); } diff --git a/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/ExternalPooledConnectionFactoryDefinition.java b/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/ExternalPooledConnectionFactoryDefinition.java index 94aa9477ef07..34e6cc5d4a9b 100644 --- a/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/ExternalPooledConnectionFactoryDefinition.java +++ b/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/ExternalPooledConnectionFactoryDefinition.java @@ -26,7 +26,6 @@ import java.util.Arrays; import java.util.Collection; - import org.jboss.as.controller.AbstractAttributeDefinitionBuilder; import org.jboss.as.controller.AttributeDefinition; import org.jboss.as.controller.AttributeMarshaller; @@ -45,6 +44,7 @@ import org.wildfly.extension.messaging.activemq.CommonAttributes; import org.wildfly.extension.messaging.activemq.MessagingExtension; import org.wildfly.extension.messaging.activemq.jms.ConnectionFactoryAttributes.Common; +import org.wildfly.extension.messaging.activemq.jms.ConnectionFactoryAttributes.External; import org.wildfly.extension.messaging.activemq.jms.ConnectionFactoryAttributes.Pooled; /** @@ -63,7 +63,7 @@ public class ExternalPooledConnectionFactoryDefinition extends PooledConnectionF // * keep in a single place the subtle differences (e.g. different default values for reconnect-attempts between // the regular and pooled CF private static ConnectionFactoryAttribute[] define(ConnectionFactoryAttribute[] specific, ConnectionFactoryAttribute... common) { - int size = common.length + specific.length; + int size = common.length + specific.length + 1; ConnectionFactoryAttribute[] result = new ConnectionFactoryAttribute[size]; for (int i = 0; i < specific.length; i++) { ConnectionFactoryAttribute attr = specific[i]; @@ -114,6 +114,7 @@ private static ConnectionFactoryAttribute[] define(ConnectionFactoryAttribute[] } result[specific.length + i] = newAttr; } + result[size -1] = ConnectionFactoryAttribute.create(External.ENABLE_AMQ1_PREFIX, "enable1xPrefixes", true); return result; } diff --git a/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/JMSQueueService.java b/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/JMSQueueService.java index 7a8ed2c08425..88b4ee2d741c 100644 --- a/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/JMSQueueService.java +++ b/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/JMSQueueService.java @@ -19,17 +19,17 @@ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ - package org.wildfly.extension.messaging.activemq.jms; import static org.jboss.as.server.Services.addServerExecutorDependency; +import static org.wildfly.extension.messaging.activemq.jms.JMSTopicService.JMS_TOPIC_PREFIX; import java.util.concurrent.ExecutorService; import java.util.concurrent.RejectedExecutionException; import javax.jms.Queue; -import org.apache.activemq.artemis.jms.client.ActiveMQQueue; +import org.apache.activemq.artemis.jms.client.ActiveMQDestination; import org.apache.activemq.artemis.jms.server.JMSServerManager; import org.jboss.msc.service.Service; import org.jboss.msc.service.ServiceBuilder; @@ -61,8 +61,12 @@ public class JMSQueueService implements Service { private Queue queue; - public JMSQueueService(final String queueName, String selectorString, boolean durable) { - this.queueName = queueName; + public JMSQueueService(final String name, String selectorString, boolean durable) { + if (name.startsWith(JMS_TOPIC_PREFIX)) { + this.queueName = name.substring(JMS_TOPIC_PREFIX.length()); + } else { + this.queueName = name; + } this.selectorString = selectorString; this.durable = durable; } @@ -76,7 +80,7 @@ public void run() { try { // add back the jms.queue. prefix to be consistent with ActiveMQ Artemis 1.x addressing scheme jmsManager.createQueue(false, JMS_QUEUE_PREFIX + queueName, queueName, selectorString, durable); - JMSQueueService.this.queue = new ActiveMQQueue(JMS_QUEUE_PREFIX + queueName, queueName); + JMSQueueService.this.queue = ActiveMQDestination.createQueue(JMS_QUEUE_PREFIX + queueName, queueName); context.complete(); } catch (Throwable e) { context.failed(MessagingLogger.ROOT_LOGGER.failedToCreate(e, "JMS Queue")); diff --git a/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/JMSTopicService.java b/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/JMSTopicService.java index 854c0ea03d8c..9ff4c7b84a36 100644 --- a/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/JMSTopicService.java +++ b/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/JMSTopicService.java @@ -19,7 +19,6 @@ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ - package org.wildfly.extension.messaging.activemq.jms; import java.util.concurrent.ExecutorService; @@ -27,7 +26,7 @@ import javax.jms.Topic; -import org.apache.activemq.artemis.jms.client.ActiveMQTopic; +import org.apache.activemq.artemis.jms.client.ActiveMQDestination; import org.apache.activemq.artemis.jms.server.JMSServerManager; import org.jboss.msc.service.Service; import org.jboss.msc.service.ServiceBuilder; @@ -57,7 +56,11 @@ public class JMSTopicService implements Service { private Topic topic; public JMSTopicService(String name) { - this.name = name; + if (name.startsWith(JMS_TOPIC_PREFIX)) { + this.name = name.substring(JMS_TOPIC_PREFIX.length()); + } else { + this.name = name; + } } @Override @@ -69,7 +72,7 @@ public void run() { try { // add back the jms.topic. prefix to be consistent with ActiveMQ Artemis 1.x addressing scheme jmsManager.createTopic(JMS_TOPIC_PREFIX + name, false, name); - topic = new ActiveMQTopic(JMS_TOPIC_PREFIX + name, name); + topic = ActiveMQDestination.createTopic(JMS_TOPIC_PREFIX + name, name); context.complete(); } catch (Throwable e) { context.failed(MessagingLogger.ROOT_LOGGER.failedToCreate(e, "JMS Topic")); diff --git a/messaging-activemq/src/main/resources/org/wildfly/extension/messaging/activemq/LocalDescriptions.properties b/messaging-activemq/src/main/resources/org/wildfly/extension/messaging/activemq/LocalDescriptions.properties index a4d6b95f1cfb..2d325e5e826c 100644 --- a/messaging-activemq/src/main/resources/org/wildfly/extension/messaging/activemq/LocalDescriptions.properties +++ b/messaging-activemq/src/main/resources/org/wildfly/extension/messaging/activemq/LocalDescriptions.properties @@ -169,6 +169,7 @@ connection-factory.discovery-initial-wait-timeout.deprecated=Has no runtime effe connection-factory.discovery-initial-wait-timeout=The discovery initial wait time out. connection-factory.discovery-refresh-timeout=Period the discovery group waits after receiving the last broadcast from a particular server before removing that server's connector pair entry from its list. connection-factory.dups-ok-batch-size=The dups ok batch size. +connection-factory.enable-amq1-prefix=Enable the use of ActiveMQ 1.5.x prefixes in the addresses. connection-factory.entries=The jndi names the connection factory should be bound to. connection-factory.factory-type=The type of connection factory. connection-factory.failover-on-initial-connection=True to fail over on initial connection. @@ -733,6 +734,7 @@ pooled-connection-factory.discovery-group=The discovery group name. pooled-connection-factory.discovery-initial-wait-timeout.deprecated=Has no runtime effect and a warning will be issued if an attempt is made to set the value of this attribute. pooled-connection-factory.discovery-initial-wait-timeout=The discovery initial wait time out. pooled-connection-factory.dups-ok-batch-size=The dups ok batch size. +pooled-connection-factory.enable-amq1-prefix=Enable the use of ActiveMQ 1.5.x prefixes in the addresses. pooled-connection-factory.enlistment-trace=Enables IronJacamar to record enlistment traces for this pooled-connection-factory. This attribute is undefined by default and the behaviour is driven by the presence of the ironjacamar.disable_enlistment_trace system property. pooled-connection-factory.entries=The jndi names the connection factory should be bound to. pooled-connection-factory.failover-on-initial-connection=True to fail over on initial connection. diff --git a/messaging-activemq/src/main/resources/schema/wildfly-messaging-activemq_7_0.xsd b/messaging-activemq/src/main/resources/schema/wildfly-messaging-activemq_7_0.xsd index acd6a83f2cb1..7ebce591b467 100644 --- a/messaging-activemq/src/main/resources/schema/wildfly-messaging-activemq_7_0.xsd +++ b/messaging-activemq/src/main/resources/schema/wildfly-messaging-activemq_7_0.xsd @@ -51,6 +51,7 @@ + @@ -101,6 +102,7 @@ + diff --git a/messaging-activemq/src/test/java/org/wildfly/extension/messaging/activemq/MessagingActiveMQSubsystem_7_0_TestCase.java b/messaging-activemq/src/test/java/org/wildfly/extension/messaging/activemq/MessagingActiveMQSubsystem_7_0_TestCase.java index 7352dc773334..00fad82b0a25 100644 --- a/messaging-activemq/src/test/java/org/wildfly/extension/messaging/activemq/MessagingActiveMQSubsystem_7_0_TestCase.java +++ b/messaging-activemq/src/test/java/org/wildfly/extension/messaging/activemq/MessagingActiveMQSubsystem_7_0_TestCase.java @@ -306,6 +306,8 @@ private void testRejectingTransformers(ModelTestControllerVersion controllerVers config.addFailedAttribute(subsystemAddress.append(EXTERNAL_JMS_TOPIC_PATH), FailedOperationTransformationConfig.REJECTED_RESOURCE); } else if (messagingVersion.compareTo(MessagingExtension.VERSION_6_0_0) > 0) { config.addFailedAttribute(subsystemAddress.append(SERVER_PATH, MessagingExtension.QUEUE_PATH), new FailedOperationTransformationConfig.NewAttributesConfig(QueueDefinition.ROUTING_TYPE)); + config.addFailedAttribute(subsystemAddress.append(POOLED_CONNECTION_FACTORY_PATH), new FailedOperationTransformationConfig.NewAttributesConfig(ConnectionFactoryAttributes.External.ENABLE_AMQ1_PREFIX)); + config.addFailedAttribute(subsystemAddress.append(CONNECTION_FACTORY_PATH), new FailedOperationTransformationConfig.NewAttributesConfig(ConnectionFactoryAttributes.External.ENABLE_AMQ1_PREFIX)); } ModelTestUtils.checkFailedTransformedBootOperations(mainServices, messagingVersion, ops, config); } diff --git a/messaging-activemq/src/test/resources/org/wildfly/extension/messaging/activemq/subsystem_7_0.xml b/messaging-activemq/src/test/resources/org/wildfly/extension/messaging/activemq/subsystem_7_0.xml index 34f8df3f2896..b8b621a0dc4b 100644 --- a/messaging-activemq/src/test/resources/org/wildfly/extension/messaging/activemq/subsystem_7_0.xml +++ b/messaging-activemq/src/test/resources/org/wildfly/extension/messaging/activemq/subsystem_7_0.xml @@ -35,7 +35,8 @@ + entries="${connection-factory.entries.entry:java:/ClientConnectionFactory}" + enable-amq1-prefix="true"/> + entries="java:/JmsLocal" + enable-amq1-prefix="true"/> + entries="${connection-factory.entries.entry:java:/ClientConnectionFactory}" + enable-amq1-prefix="false"/> + entries="java:/JmsLocal" + enable-amq1-prefix="false"/>