Skip to content

Commit

Permalink
[WFLY-12038]: Expose the enable1Prefixes configuration on external (p…
Browse files Browse the repository at this point in the history
…ooled) connection factories.

* Adding a new attribute 'enable-amq1-prefix' on external connection
factories to override the use of those compatibility prefixes when
connecting to a remote artemis broker.

Jira: https://issues.jboss.org/browse/WFLY-12038
  • Loading branch information
ehsavoie committed May 22, 2019
1 parent 7b65d95 commit 924bd31
Show file tree
Hide file tree
Showing 15 changed files with 149 additions and 95 deletions.
Expand Up @@ -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

Expand Down
Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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;
}

}
Expand Up @@ -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) {
Expand Down
Expand Up @@ -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);
Expand Down

0 comments on commit 924bd31

Please sign in to comment.