@@ -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 @@
static final RuntimeCapability<Void> 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;

@@ -44,6 +44,7 @@
public class ExternalConnectionFactoryService implements Service<ConnectionFactory> {

private final boolean ha;
private final boolean enable1Prefixes;
private final DiscoveryGroupConfiguration groupConfiguration;
private final TransportConfiguration[] connectors;
private final JMSFactoryType type;
@@ -59,16 +60,17 @@

ExternalConnectionFactoryService(DiscoveryGroupConfiguration groupConfiguration,
Map<String, Supplier<CommandDispatcherFactory>> commandDispatcherFactories,
Map<String, Supplier<SocketBinding>> groupBindings, Map<String, String> clusterNames, JMSFactoryType type, boolean ha) {
this(ha, type, groupConfiguration, Collections.emptyMap(), Collections.emptyMap(),commandDispatcherFactories, groupBindings, clusterNames, null);
Map<String, Supplier<SocketBinding>> groupBindings, Map<String, String> clusterNames, JMSFactoryType type, boolean ha, boolean enable1Prefixes) {
this(ha, enable1Prefixes, type, groupConfiguration, Collections.emptyMap(), Collections.emptyMap(),commandDispatcherFactories, groupBindings, clusterNames, null);
}

ExternalConnectionFactoryService(TransportConfiguration[] connectors, Map<String, Supplier<SocketBinding>> socketBindings,
Map<String, Supplier<OutboundSocketBinding>> outboundSocketBindings, JMSFactoryType type, boolean ha) {
this(ha, type, null, socketBindings, outboundSocketBindings, Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), connectors);
Map<String, Supplier<OutboundSocketBinding>> 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<String, Supplier<SocketBinding>> 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");
}
@@ -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 @@
// * 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 @@
}
result[specific.length + i] = newAttr;
}
result[size -1] = ConnectionFactoryAttribute.create(External.ENABLE_AMQ1_PREFIX, "enable1xPrefixes", true);
return result;
}

@@ -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 @@

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"));
@@ -19,15 +19,14 @@
* 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;
import java.util.concurrent.RejectedExecutionException;

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 @@
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"));
@@ -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.
@@ -51,6 +51,7 @@
<xs:attribute name="discovery-group" type="xs:string" use="optional"/>
<xs:attribute name="connectors" type="xs:string" use="optional"/>
<xs:attribute name="entries" type="stringList" use="required" />
<xs:attribute name="enable-amq1-prefix" type="xs:boolean" use="optional" />
</xs:complexType>
</xs:element>
<xs:element name="pooled-connection-factory" minOccurs="0" maxOccurs="unbounded">
@@ -101,6 +102,7 @@
<xs:attribute name="enlistment-trace" type="xs:boolean" use="optional" />
<xs:attribute name="initial-connect-attempts" type="xs:int" use="optional" />
<xs:attribute name="statistics-enabled" type="xs:boolean" use="optional" />
<xs:attribute name="enable-amq1-prefix" type="xs:boolean" use="optional" />
</xs:complexType>
</xs:element>
<xs:element name="external-jms-queue" minOccurs="0" maxOccurs="unbounded">
@@ -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);
}
@@ -35,7 +35,8 @@

<connection-factory name="InVmConnectionFactory"
connectors="in-vm client"
entries="${connection-factory.entries.entry:java:/ClientConnectionFactory}" />
entries="${connection-factory.entries.entry:java:/ClientConnectionFactory}"
enable-amq1-prefix="true"/>

<connection-factory name="RemoteClientConnectionFactory"
factory-type="XA_QUEUE"
@@ -53,7 +54,8 @@
password="alicepassword"
use-auto-recovery="${use.auto.recovery:true}"
connectors="in-vm-client"
entries="java:/JmsLocal"/>
entries="java:/JmsLocal"
enable-amq1-prefix="true"/>

<pooled-connection-factory name="activemq-ra-none"
transaction="none"
@@ -30,15 +30,17 @@

<connection-factory name="InVmConnectionFactory"
connectors="in-vm-client"
entries="${connection-factory.entries.entry:java:/ClientConnectionFactory}" />
entries="${connection-factory.entries.entry:java:/ClientConnectionFactory}"
enable-amq1-prefix="false"/>

<pooled-connection-factory name="hornetq-ra-local"
transaction="local"
user="alice"
password="alicepassword"
use-auto-recovery="${use.auto.recovery:true}"
connectors="in-vm-client"
entries="java:/JmsLocal"/>
entries="java:/JmsLocal"
enable-amq1-prefix="false"/>

<external-jms-queue name="testQueue"
entries="${jms-queue.entry:queue/client-test}"/>