diff --git a/.gitignore b/.gitignore
index 7af8f9fc2d..015033e264 100644
--- a/.gitignore
+++ b/.gitignore
@@ -58,11 +58,6 @@ integration/activemq-*-integration/.project
# /distribution/activemq/
/distribution/activemq/.project
-# /distribution/jnp-client/
-/distribution/jnp-client/target
-/distribution/jnp-client/bin
-/distribution/jnp-client/.project
-
# /docs/
/docs/.project
diff --git a/activemq-bootstrap/src/main/java/org/apache/activemq/cli/commands/Run.java b/activemq-bootstrap/src/main/java/org/apache/activemq/cli/commands/Run.java
index 8bab07e57e..a83be7557c 100644
--- a/activemq-bootstrap/src/main/java/org/apache/activemq/cli/commands/Run.java
+++ b/activemq-bootstrap/src/main/java/org/apache/activemq/cli/commands/Run.java
@@ -34,7 +34,6 @@ import org.apache.activemq.integration.bootstrap.ActiveMQBootstrapLogger;
import org.apache.activemq.jms.server.JMSServerManager;
import org.apache.activemq.jms.server.config.JMSConfiguration;
import org.apache.activemq.jms.server.impl.JMSServerManagerImpl;
-import org.apache.activemq.jms.server.impl.StandaloneNamingServer;
import org.apache.activemq.spi.core.security.ActiveMQSecurityManager;
import javax.management.MBeanServer;
@@ -51,7 +50,6 @@ public class Run implements Action
@Arguments(description = "Broker Configuration URI, default 'xml:${ACTIVEMQ_HOME}/config/non-clustered/bootstrap.xml'")
String configuration;
- private StandaloneNamingServer namingServer;
private JMSServerManager jmsServerManager;
private ArrayList components = new ArrayList<>();
@@ -84,20 +82,6 @@ public class Run implements Action
ActiveMQServerImpl server = new ActiveMQServerImpl(core, mBeanServer, security);
- namingServer = new StandaloneNamingServer(server);
-
- namingServer.setBindAddress(broker.naming.bindAddress);
-
- namingServer.setPort(broker.naming.port);
-
- namingServer.setRmiBindAddress(broker.naming.rmiBindAddress);
-
- namingServer.setRmiPort(broker.naming.rmiPort);
-
- namingServer.start();
-
- ActiveMQBootstrapLogger.LOGGER.startedNamingService(broker.naming.bindAddress, broker.naming.port, broker.naming.rmiBindAddress, broker.naming.rmiPort);
-
if (jms != null)
{
jmsServerManager = new JMSServerManagerImpl(server, jms);
diff --git a/activemq-dto/src/main/java/org/apache/activemq/dto/BrokerDTO.java b/activemq-dto/src/main/java/org/apache/activemq/dto/BrokerDTO.java
index 70e6767cbd..c6f8974a49 100644
--- a/activemq-dto/src/main/java/org/apache/activemq/dto/BrokerDTO.java
+++ b/activemq-dto/src/main/java/org/apache/activemq/dto/BrokerDTO.java
@@ -40,9 +40,6 @@ public class BrokerDTO
@XmlElementRef
public SecurityDTO security;
- @XmlElementRef
- public NamingDTO naming;
-
@XmlElementRef(required = false)
public WebServerDTO web;
diff --git a/activemq-dto/src/main/resources/org/apache/activemq/dto/jaxb.index b/activemq-dto/src/main/resources/org/apache/activemq/dto/jaxb.index
index d4f5b1f263..9cffb01307 100644
--- a/activemq-dto/src/main/resources/org/apache/activemq/dto/jaxb.index
+++ b/activemq-dto/src/main/resources/org/apache/activemq/dto/jaxb.index
@@ -19,5 +19,4 @@ CoreDTO
JmsDTO
SecurityDTO
BasicSecurityDTO
-NamingDTO
diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ActiveMQInitialContextFactory.java b/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ActiveMQInitialContextFactory.java
new file mode 100644
index 0000000000..18b145dc58
--- /dev/null
+++ b/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ActiveMQInitialContextFactory.java
@@ -0,0 +1,496 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.jndi;
+
+import javax.jms.Queue;
+import javax.jms.Topic;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.spi.InitialContextFactory;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.StringTokenizer;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
+import org.apache.activemq.api.core.JGroupsBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.TransportConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.client.ActiveMQClient;
+import org.apache.activemq.api.jms.ActiveMQJMSClient;
+import org.apache.activemq.api.jms.JMSFactoryType;
+import org.apache.activemq.core.client.ActiveMQClientLogger;
+import org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory;
+import org.apache.activemq.core.remoting.impl.netty.TransportConstants;
+import org.apache.activemq.jms.client.ActiveMQConnectionFactory;
+
+/**
+ * A factory of the ActiveMQ InitialContext which contains
+ * {@link javax.jms.ConnectionFactory} instances as well as a child context called
+ * destinations which contain all of the current active destinations, in
+ * child context depending on the QoS such as transient or durable and queue or
+ * topic.
+ */
+public class ActiveMQInitialContextFactory implements InitialContextFactory
+{
+ public static final String CONNECTION_FACTORY_NAMES = "connectionFactoryNames";
+ public static final String REFRESH_TIMEOUT = "refresh-timeout";
+ public static final String DISCOVERY_INITIAL_WAIT_TIMEOUT = "discovery-initial-wait-timeout";
+
+ private static final String[] DEFAULT_CONNECTION_FACTORY_NAMES = {"ConnectionFactory", "XAConnectionFactory", "QueueConnectionFactory", "TopicConnectionFactory"};
+ public static final String TCP_SCHEME = "tcp";
+ public static final String JGROUPS_SCHEME = "jgroups";
+ public static final String UDP_SCHEME = "udp";
+ public static final String VM_SCHEME = "vm";
+ public static final String HA = "ha";
+ public static final String CF_TYPE = "type";
+ public static final String QUEUE_CF = "QUEUE_CF";
+ public static final String TOPIC_CF = "TOPIC_CF";
+ public static final String QUEUE_XA_CF = "QUEUE_XA_CF";
+ public static final String TOPIC_XA_CF = "TOPIC_XA_CF";
+ public static final String XA_CF = "XA_CF";
+ public static final String DYNAMIC_QUEUE_CONTEXT = "dynamicQueues";
+ public static final String DYNAMIC_TOPIC_CONTEXT = "dynamicTopics";
+
+ private String connectionPrefix = "connection.";
+ private String queuePrefix = "queue.";
+ private String topicPrefix = "topic.";
+
+ public Context getInitialContext(Hashtable environment) throws NamingException
+ {
+ // lets create a factory
+ Map data = new ConcurrentHashMap();
+ String[] names = getConnectionFactoryNames(environment);
+ for (int i = 0; i < names.length; i++)
+ {
+ ActiveMQConnectionFactory factory = null;
+ String name = names[i];
+
+ try
+ {
+ factory = createConnectionFactory(name, environment);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new NamingException("Invalid broker URL");
+ }
+
+ data.put(name, factory);
+ }
+
+ createQueues(data, environment);
+ createTopics(data, environment);
+
+ data.put(DYNAMIC_QUEUE_CONTEXT, new LazyCreateContext()
+ {
+ private static final long serialVersionUID = 6503881346214855588L;
+
+ protected Object createEntry(String name)
+ {
+ return ActiveMQJMSClient.createQueue(name);
+ }
+ });
+ data.put(DYNAMIC_TOPIC_CONTEXT, new LazyCreateContext()
+ {
+ private static final long serialVersionUID = 2019166796234979615L;
+
+ protected Object createEntry(String name)
+ {
+ return ActiveMQJMSClient.createTopic(name);
+ }
+ });
+
+ return createContext(environment, data);
+ }
+
+ // Properties
+ // -------------------------------------------------------------------------
+ public String getTopicPrefix()
+ {
+ return topicPrefix;
+ }
+
+ public void setTopicPrefix(String topicPrefix)
+ {
+ this.topicPrefix = topicPrefix;
+ }
+
+ public String getQueuePrefix()
+ {
+ return queuePrefix;
+ }
+
+ public void setQueuePrefix(String queuePrefix)
+ {
+ this.queuePrefix = queuePrefix;
+ }
+
+ // Implementation methods
+ // -------------------------------------------------------------------------
+
+ protected ReadOnlyContext createContext(Hashtable environment, Map data)
+ {
+ return new ReadOnlyContext(environment, data);
+ }
+
+ protected ActiveMQConnectionFactory createConnectionFactory(String name, Hashtable environment) throws URISyntaxException, MalformedURLException
+ {
+ Hashtable connectionFactoryProperties = new Hashtable(environment);
+ if (DEFAULT_CONNECTION_FACTORY_NAMES[1].equals(name))
+ {
+ connectionFactoryProperties.put(CF_TYPE, XA_CF);
+ }
+ if (DEFAULT_CONNECTION_FACTORY_NAMES[2].equals(name))
+ {
+ connectionFactoryProperties.put(CF_TYPE, QUEUE_CF);
+ }
+ if (DEFAULT_CONNECTION_FACTORY_NAMES[3].equals(name))
+ {
+ connectionFactoryProperties.put(CF_TYPE, TOPIC_CF);
+ }
+ String prefix = connectionPrefix + name + ".";
+ for (Iterator iter = environment.entrySet().iterator(); iter.hasNext(); )
+ {
+ Map.Entry entry = (Map.Entry) iter.next();
+ String key = (String) entry.getKey();
+ if (key.startsWith(prefix))
+ {
+ // Rename the key...
+ connectionFactoryProperties.remove(key);
+ key = key.substring(prefix.length());
+ connectionFactoryProperties.put(key, entry.getValue());
+ }
+ }
+ return createConnectionFactory(connectionFactoryProperties);
+ }
+
+ protected String[] getConnectionFactoryNames(Map environment)
+ {
+ String factoryNames = (String) environment.get(CONNECTION_FACTORY_NAMES);
+ if (factoryNames != null)
+ {
+ List list = new ArrayList();
+ for (StringTokenizer enumeration = new StringTokenizer(factoryNames, ","); enumeration.hasMoreTokens(); )
+ {
+ list.add(enumeration.nextToken().trim());
+ }
+ int size = list.size();
+ if (size > 0)
+ {
+ String[] answer = new String[size];
+ list.toArray(answer);
+ return answer;
+ }
+ }
+ return DEFAULT_CONNECTION_FACTORY_NAMES;
+ }
+
+ protected void createQueues(Map data, Hashtable environment)
+ {
+ for (Iterator iter = environment.entrySet().iterator(); iter.hasNext(); )
+ {
+ Map.Entry entry = (Map.Entry) iter.next();
+ String key = entry.getKey().toString();
+ if (key.startsWith(queuePrefix))
+ {
+ String jndiName = key.substring(queuePrefix.length());
+ data.put(jndiName, createQueue(entry.getValue().toString()));
+ }
+ }
+ }
+
+ protected void createTopics(Map data, Hashtable environment)
+ {
+ for (Iterator iter = environment.entrySet().iterator(); iter.hasNext(); )
+ {
+ Map.Entry entry = (Map.Entry) iter.next();
+ String key = entry.getKey().toString();
+ if (key.startsWith(topicPrefix))
+ {
+ String jndiName = key.substring(topicPrefix.length());
+ data.put(jndiName, createTopic(entry.getValue().toString()));
+ }
+ }
+ }
+
+ /**
+ * Factory method to create new Queue instances
+ */
+ protected Queue createQueue(String name)
+ {
+ return ActiveMQJMSClient.createQueue(name);
+ }
+
+ /**
+ * Factory method to create new Topic instances
+ */
+ protected Topic createTopic(String name)
+ {
+ return ActiveMQJMSClient.createTopic(name);
+ }
+
+ /**
+ * Factory method to create a new connection factory from the given environment
+ */
+ protected ActiveMQConnectionFactory createConnectionFactory(Hashtable environment) throws URISyntaxException, MalformedURLException
+ {
+ ActiveMQConnectionFactory connectionFactory;
+ Map transportConfig = new HashMap();
+
+ if (environment.containsKey(Context.PROVIDER_URL))
+ {
+ URI providerURI = new URI(((String)environment.get(Context.PROVIDER_URL)));
+
+ if (providerURI.getQuery() != null)
+ {
+ try
+ {
+ transportConfig = parseQuery(providerURI.getQuery());
+ }
+ catch (URISyntaxException e)
+ {
+ }
+ }
+
+ if (providerURI.getScheme().equals(TCP_SCHEME))
+ {
+ String[] connectors = providerURI.getAuthority().split(",");
+ TransportConfiguration[] transportConfigurations = new TransportConfiguration[connectors.length];
+ for (int i = 0; i < connectors.length; i++)
+ {
+ Map individualTransportConfig = new HashMap(transportConfig);
+ String[] hostAndPort = connectors[i].split(":");
+ individualTransportConfig.put(TransportConstants.HOST_PROP_NAME, hostAndPort[0]);
+ individualTransportConfig.put(TransportConstants.PORT_PROP_NAME, hostAndPort[1]);
+ transportConfigurations[i] = new TransportConfiguration(NettyConnectorFactory.class.getCanonicalName(), individualTransportConfig);
+ }
+
+ if (Boolean.TRUE.equals(environment.get(HA)))
+ {
+ connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithHA(getJmsFactoryType(environment), transportConfigurations);
+ }
+ else
+ {
+ connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(getJmsFactoryType(environment), transportConfigurations);
+ }
+ }
+ else if (providerURI.getScheme().equals(UDP_SCHEME))
+ {
+ DiscoveryGroupConfiguration dgc = new DiscoveryGroupConfiguration()
+ .setRefreshTimeout(transportConfig.containsKey(REFRESH_TIMEOUT) ? Long.parseLong((String) transportConfig.get(REFRESH_TIMEOUT)) : ActiveMQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT)
+ .setDiscoveryInitialWaitTimeout(transportConfig.containsKey(DISCOVERY_INITIAL_WAIT_TIMEOUT) ? Long.parseLong((String) transportConfig.get(DISCOVERY_INITIAL_WAIT_TIMEOUT)) : ActiveMQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT)
+ .setBroadcastEndpointFactoryConfiguration(new UDPBroadcastGroupConfiguration()
+ .setGroupAddress(providerURI.getHost())
+ .setGroupPort(providerURI.getPort())
+ .setLocalBindAddress(transportConfig.containsKey(TransportConstants.LOCAL_ADDRESS_PROP_NAME) ? (String) transportConfig.get(TransportConstants.LOCAL_ADDRESS_PROP_NAME) : null)
+ .setLocalBindPort(transportConfig.containsKey(TransportConstants.LOCAL_PORT_PROP_NAME) ? Integer.parseInt((String) transportConfig.get(TransportConstants.LOCAL_PORT_PROP_NAME)) : -1));
+ if (Boolean.TRUE.equals(environment.get(HA)))
+ {
+ connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithHA(dgc, getJmsFactoryType(environment));
+ }
+ else
+ {
+ connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(dgc, getJmsFactoryType(environment));
+ }
+ }
+ else if (providerURI.getScheme().equals(JGROUPS_SCHEME))
+ {
+ JGroupsBroadcastGroupConfiguration config = new JGroupsBroadcastGroupConfiguration(providerURI.getAuthority(), providerURI.getPath() != null ? providerURI.getPath() : UUID.randomUUID().toString());
+
+ DiscoveryGroupConfiguration dgc = new DiscoveryGroupConfiguration()
+ .setRefreshTimeout(transportConfig.containsKey(REFRESH_TIMEOUT) ? Long.parseLong((String) transportConfig.get(REFRESH_TIMEOUT)) : ActiveMQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT)
+ .setDiscoveryInitialWaitTimeout(transportConfig.containsKey(DISCOVERY_INITIAL_WAIT_TIMEOUT) ? Long.parseLong((String) transportConfig.get(DISCOVERY_INITIAL_WAIT_TIMEOUT)) : ActiveMQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT)
+ .setBroadcastEndpointFactoryConfiguration(config);
+ if (Boolean.TRUE.equals(environment.get(HA)))
+ {
+ connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithHA(dgc, getJmsFactoryType(environment));
+ }
+ else
+ {
+ connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(dgc, getJmsFactoryType(environment));
+ }
+ }
+ else if (providerURI.getScheme().equals(VM_SCHEME))
+ {
+ Map inVmTransportConfig = new HashMap();
+ inVmTransportConfig.put("server-id", providerURI.getHost());
+ TransportConfiguration tc = new TransportConfiguration("org.apache.activemq.core.remoting.impl.invm.InVMConnectorFactory", inVmTransportConfig);
+ connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(getJmsFactoryType(environment), tc);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Invalid scheme");
+ }
+ }
+ else
+ {
+ TransportConfiguration tc = new TransportConfiguration("org.apache.activemq.core.remoting.impl.invm.InVMConnectorFactory");
+ connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(getJmsFactoryType(environment), tc);
+ }
+
+ Properties properties = new Properties();
+ properties.putAll(environment);
+
+ for (Object key : environment.keySet())
+ {
+ invokeSetter(connectionFactory, (String) key, environment.get(key));
+ }
+
+ return connectionFactory;
+ }
+
+ private JMSFactoryType getJmsFactoryType(Hashtable environment)
+ {
+ JMSFactoryType ultimateType = JMSFactoryType.CF; // default value
+ if (environment.containsKey(CF_TYPE))
+ {
+ String tempType = (String) environment.get(CF_TYPE);
+ if (QUEUE_CF.equals(tempType))
+ {
+ ultimateType = JMSFactoryType.QUEUE_CF;
+ }
+ else if (TOPIC_CF.equals(tempType))
+ {
+ ultimateType = JMSFactoryType.TOPIC_CF;
+ }
+ else if (QUEUE_XA_CF.equals(tempType))
+ {
+ ultimateType = JMSFactoryType.QUEUE_XA_CF;
+ }
+ else if (TOPIC_XA_CF.equals(tempType))
+ {
+ ultimateType = JMSFactoryType.TOPIC_XA_CF;
+ }
+ else if (XA_CF.equals(tempType))
+ {
+ ultimateType = JMSFactoryType.XA_CF;
+ }
+ }
+ return ultimateType;
+ }
+
+
+ public static Map parseQuery(String uri) throws URISyntaxException
+ {
+ try
+ {
+ uri = uri.substring(uri.lastIndexOf("?") + 1); // get only the relevant part of the query
+ Map rc = new HashMap();
+ if (uri != null && !uri.isEmpty())
+ {
+ String[] parameters = uri.split("&");
+ for (int i = 0; i < parameters.length; i++)
+ {
+ int p = parameters[i].indexOf("=");
+ if (p >= 0)
+ {
+ String name = URLDecoder.decode(parameters[i].substring(0, p), "UTF-8");
+ String value = URLDecoder.decode(parameters[i].substring(p + 1), "UTF-8");
+ rc.put(name, value);
+ }
+ else
+ {
+ rc.put(parameters[i], null);
+ }
+ }
+ }
+ return rc;
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e);
+ }
+ }
+
+ public String getConnectionPrefix()
+ {
+ return connectionPrefix;
+ }
+
+ public void setConnectionPrefix(String connectionPrefix)
+ {
+ this.connectionPrefix = connectionPrefix;
+ }
+
+ private void invokeSetter(Object target, final String propertyName, final Object propertyValue)
+ {
+ Method setter = null;
+
+ Method[] methods = target.getClass().getMethods();
+
+ // turn something like "consumerWindowSize" to "setConsumerWindowSize"
+ String setterMethodName = "set" + Character.toUpperCase(propertyName.charAt(0)) + propertyName.substring(1);
+
+ for (Method m : methods)
+ {
+ if (m.getName().equals(setterMethodName))
+ {
+ setter = m;
+ break;
+ }
+ }
+
+ try
+ {
+ if (setter != null)
+ {
+ ActiveMQClientLogger.LOGGER.info("Invoking: " + setter + " that takes a " + setter.getParameterTypes()[0] + " with a " + propertyValue.getClass());
+ if (propertyValue.getClass() == String.class && setter.getParameterTypes()[0] != String.class)
+ {
+ String stringPropertyValue = (String) propertyValue;
+ if (setter.getParameterTypes()[0] == Integer.TYPE)
+ {
+ setter.invoke(target, Integer.parseInt(stringPropertyValue));
+ }
+ else if (setter.getParameterTypes()[0] == Long.TYPE)
+ {
+ setter.invoke(target, Long.parseLong(stringPropertyValue));
+ }
+ else if (setter.getParameterTypes()[0] == Double.TYPE)
+ {
+ setter.invoke(target, Double.parseDouble(stringPropertyValue));
+ }
+ else if (setter.getParameterTypes()[0] == Boolean.TYPE)
+ {
+ setter.invoke(target, Boolean.parseBoolean(stringPropertyValue));
+ }
+ }
+ else
+ {
+ setter.invoke(target, propertyValue);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ ActiveMQClientLogger.LOGGER.warn("Caught exception during invocation of: " + setter, e);
+ }
+ }
+}
diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/jndi/LazyCreateContext.java b/activemq-jms-client/src/main/java/org/apache/activemq/jndi/LazyCreateContext.java
new file mode 100644
index 0000000000..0fe51bcc1e
--- /dev/null
+++ b/activemq-jms-client/src/main/java/org/apache/activemq/jndi/LazyCreateContext.java
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.jndi;
+
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+
+public abstract class LazyCreateContext extends ReadOnlyContext
+{
+ public Object lookup(String name) throws NamingException
+ {
+ try
+ {
+ return super.lookup(name);
+ }
+ catch (NameNotFoundException e)
+ {
+ Object answer = createEntry(name);
+ if (answer == null)
+ {
+ throw e;
+ }
+ internalBind(name, answer);
+ return answer;
+ }
+ }
+
+ protected abstract Object createEntry(String name);
+}
diff --git a/activemq-dto/src/main/java/org/apache/activemq/dto/NamingDTO.java b/activemq-jms-client/src/main/java/org/apache/activemq/jndi/NameParserImpl.java
similarity index 59%
rename from activemq-dto/src/main/java/org/apache/activemq/dto/NamingDTO.java
rename to activemq-jms-client/src/main/java/org/apache/activemq/jndi/NameParserImpl.java
index a2aa5b64ef..8ae21cfebf 100644
--- a/activemq-dto/src/main/java/org/apache/activemq/dto/NamingDTO.java
+++ b/activemq-jms-client/src/main/java/org/apache/activemq/jndi/NameParserImpl.java
@@ -14,26 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.activemq.dto;
+package org.apache.activemq.jndi;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlRootElement;
+import javax.naming.CompositeName;
+import javax.naming.Name;
+import javax.naming.NameParser;
+import javax.naming.NamingException;
-@XmlRootElement(name = "naming")
-@XmlAccessorType(XmlAccessType.FIELD)
-public class NamingDTO
+public class NameParserImpl implements NameParser
{
- @XmlAttribute
- public String bindAddress = "localhost";
-
- @XmlAttribute
- public int port = 1099;
-
- @XmlAttribute
- public String rmiBindAddress = "localhost";
-
- @XmlAttribute
- public int rmiPort = 1098;
+ public Name parse(String name) throws NamingException
+ {
+ return new CompositeName(name);
+ }
}
diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ReadOnlyContext.java b/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ReadOnlyContext.java
new file mode 100644
index 0000000000..9602d1a2b0
--- /dev/null
+++ b/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ReadOnlyContext.java
@@ -0,0 +1,534 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.jndi;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+import javax.naming.Binding;
+import javax.naming.CompositeName;
+import javax.naming.Context;
+import javax.naming.LinkRef;
+import javax.naming.Name;
+import javax.naming.NameClassPair;
+import javax.naming.NameNotFoundException;
+import javax.naming.NameParser;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.NotContextException;
+import javax.naming.OperationNotSupportedException;
+import javax.naming.Reference;
+import javax.naming.spi.NamingManager;
+
+import org.apache.activemq.core.client.ActiveMQClientLogger;
+
+/**
+ * A read-only Context This version assumes it and all its subcontext are
+ * read-only and any attempt to modify (e.g. through bind) will result in an
+ * OperationNotSupportedException. Each Context in the tree builds a cache of
+ * the entries in all sub-contexts to optimise the performance of lookup.
+ *
+ *
+ * This implementation is intended to optimise the performance of lookup(String)
+ * to about the level of a HashMap get. It has been observed that the scheme
+ * resolution phase performed by the JVM takes considerably longer, so for
+ * optimum performance lookups should be coded like:
+ *
+ *
+ * Context componentContext = (Context)new InitialContext().lookup("java:comp");
+ * String envEntry = (String) componentContext.lookup("env/myEntry");
+ * String envEntry2 = (String) componentContext.lookup("env/myEntry2");
+ *
+ */
+@SuppressWarnings("unchecked")
+public class ReadOnlyContext implements Context, Serializable
+{
+ public static final String SEPARATOR = "/";
+ protected static final NameParser NAME_PARSER = new NameParserImpl();
+ private static final long serialVersionUID = -5754338187296859149L;
+
+ protected final Hashtable environment; // environment for this context
+ protected final Map bindings; // bindings at my level
+ protected final Map treeBindings; // all bindings under me
+
+ private boolean frozen;
+ private String nameInNamespace = "";
+
+ public ReadOnlyContext()
+ {
+ environment = new Hashtable();
+ bindings = new HashMap();
+ treeBindings = new HashMap();
+ }
+
+ public ReadOnlyContext(Hashtable env)
+ {
+ if (env == null)
+ {
+ this.environment = new Hashtable();
+ }
+ else
+ {
+ this.environment = new Hashtable(env);
+ }
+ this.bindings = Collections.EMPTY_MAP;
+ this.treeBindings = Collections.EMPTY_MAP;
+ }
+
+ public ReadOnlyContext(Hashtable environment, Map bindings)
+ {
+ if (environment == null)
+ {
+ this.environment = new Hashtable();
+ }
+ else
+ {
+ this.environment = new Hashtable(environment);
+ }
+ this.bindings = new HashMap();
+ treeBindings = new HashMap();
+ if (bindings != null)
+ {
+ for (Map.Entry binding : bindings.entrySet())
+ {
+ try
+ {
+ internalBind(binding.getKey(), binding.getValue());
+ }
+ catch (Throwable e)
+ {
+ ActiveMQClientLogger.LOGGER.error("Failed to bind " + binding.getKey() + "=" + binding.getValue(), e);
+ }
+ }
+ }
+ frozen = true;
+ }
+
+ public ReadOnlyContext(Hashtable environment, Map bindings, String nameInNamespace)
+ {
+ this(environment, bindings);
+ this.nameInNamespace = nameInNamespace;
+ }
+
+ protected ReadOnlyContext(ReadOnlyContext clone, Hashtable env)
+ {
+ this.bindings = clone.bindings;
+ this.treeBindings = clone.treeBindings;
+ this.environment = new Hashtable(env);
+ }
+
+ protected ReadOnlyContext(ReadOnlyContext clone, Hashtable env, String nameInNamespace)
+ {
+ this(clone, env);
+ this.nameInNamespace = nameInNamespace;
+ }
+
+ public void freeze()
+ {
+ frozen = true;
+ }
+
+ boolean isFrozen()
+ {
+ return frozen;
+ }
+
+ /**
+ * internalBind is intended for use only during setup or possibly by
+ * suitably synchronized superclasses. It binds every possible lookup into a
+ * map in each context. To do this, each context strips off one name segment
+ * and if necessary creates a new context for it. Then it asks that context
+ * to bind the remaining name. It returns a map containing all the bindings
+ * from the next context, plus the context it just created (if it in fact
+ * created it). (the names are suitably extended by the segment originally
+ * lopped off).
+ *
+ * @param name
+ * @param value
+ * @return
+ * @throws javax.naming.NamingException
+ */
+ protected Map internalBind(String name, Object value) throws NamingException
+ {
+ assert name != null && name.length() > 0;
+ assert !frozen;
+
+ Map newBindings = new HashMap();
+ int pos = name.indexOf('/');
+ if (pos == -1)
+ {
+ if (treeBindings.put(name, value) != null)
+ {
+ throw new NamingException("Something already bound at " + name);
+ }
+ bindings.put(name, value);
+ newBindings.put(name, value);
+ }
+ else
+ {
+ String segment = name.substring(0, pos);
+ assert segment != null;
+ assert !segment.equals("");
+ Object o = treeBindings.get(segment);
+ if (o == null)
+ {
+ o = newContext();
+ treeBindings.put(segment, o);
+ bindings.put(segment, o);
+ newBindings.put(segment, o);
+ }
+ else if (!(o instanceof ReadOnlyContext))
+ {
+ throw new NamingException("Something already bound where a subcontext should go");
+ }
+ ReadOnlyContext readOnlyContext = (ReadOnlyContext) o;
+ String remainder = name.substring(pos + 1);
+ Map subBindings = readOnlyContext.internalBind(remainder, value);
+ for (Iterator iterator = subBindings.entrySet().iterator(); iterator.hasNext(); )
+ {
+ Map.Entry entry = (Map.Entry) iterator.next();
+ String subName = segment + "/" + (String) entry.getKey();
+ Object bound = entry.getValue();
+ treeBindings.put(subName, bound);
+ newBindings.put(subName, bound);
+ }
+ }
+ return newBindings;
+ }
+
+ protected ReadOnlyContext newContext()
+ {
+ return new ReadOnlyContext();
+ }
+
+ public Object addToEnvironment(String propName, Object propVal) throws NamingException
+ {
+ return environment.put(propName, propVal);
+ }
+
+ public Hashtable getEnvironment() throws NamingException
+ {
+ return (Hashtable) environment.clone();
+ }
+
+ public Object removeFromEnvironment(String propName) throws NamingException
+ {
+ return environment.remove(propName);
+ }
+
+ public Object lookup(String name) throws NamingException
+ {
+ if (name.length() == 0)
+ {
+ return this;
+ }
+ Object result = treeBindings.get(name);
+ if (result == null)
+ {
+ result = bindings.get(name);
+ }
+ if (result == null)
+ {
+ int pos = name.indexOf(':');
+ if (pos > 0)
+ {
+ String scheme = name.substring(0, pos);
+ Context ctx = NamingManager.getURLContext(scheme, environment);
+ if (ctx == null)
+ {
+ throw new NamingException("scheme " + scheme + " not recognized");
+ }
+ return ctx.lookup(name);
+ }
+ else
+ {
+ // Split out the first name of the path
+ // and look for it in the bindings map.
+ CompositeName path = new CompositeName(name);
+
+ if (path.size() == 0)
+ {
+ return this;
+ }
+ else
+ {
+ String first = path.get(0);
+ Object obj = bindings.get(first);
+ if (obj == null)
+ {
+ throw new NameNotFoundException(name);
+ }
+ else if (obj instanceof Context && path.size() > 1)
+ {
+ Context subContext = (Context) obj;
+ obj = subContext.lookup(path.getSuffix(1));
+ }
+ return obj;
+ }
+ }
+ }
+ if (result instanceof LinkRef)
+ {
+ LinkRef ref = (LinkRef) result;
+ result = lookup(ref.getLinkName());
+ }
+ if (result instanceof Reference)
+ {
+ try
+ {
+ result = NamingManager.getObjectInstance(result, null, null, this.environment);
+ }
+ catch (NamingException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw (NamingException) new NamingException("could not look up : " + name).initCause(e);
+ }
+ }
+ if (result instanceof ReadOnlyContext)
+ {
+ String prefix = getNameInNamespace();
+ if (prefix.length() > 0)
+ {
+ prefix = prefix + SEPARATOR;
+ }
+ result = new ReadOnlyContext((ReadOnlyContext) result, environment, prefix + name);
+ }
+ return result;
+ }
+
+ public Object lookup(Name name) throws NamingException
+ {
+ return lookup(name.toString());
+ }
+
+ public Object lookupLink(String name) throws NamingException
+ {
+ return lookup(name);
+ }
+
+ public Name composeName(Name name, Name prefix) throws NamingException
+ {
+ Name result = (Name) prefix.clone();
+ result.addAll(name);
+ return result;
+ }
+
+ public String composeName(String name, String prefix) throws NamingException
+ {
+ CompositeName result = new CompositeName(prefix);
+ result.addAll(new CompositeName(name));
+ return result.toString();
+ }
+
+ public NamingEnumeration list(String name) throws NamingException
+ {
+ Object o = lookup(name);
+ if (o == this)
+ {
+ return new ListEnumeration();
+ }
+ else if (o instanceof Context)
+ {
+ return ((Context) o).list("");
+ }
+ else
+ {
+ throw new NotContextException();
+ }
+ }
+
+ public NamingEnumeration listBindings(String name) throws NamingException
+ {
+ Object o = lookup(name);
+ if (o == this)
+ {
+ return new ListBindingEnumeration();
+ }
+ else if (o instanceof Context)
+ {
+ return ((Context) o).listBindings("");
+ }
+ else
+ {
+ throw new NotContextException();
+ }
+ }
+
+ public Object lookupLink(Name name) throws NamingException
+ {
+ return lookupLink(name.toString());
+ }
+
+ public NamingEnumeration list(Name name) throws NamingException
+ {
+ return list(name.toString());
+ }
+
+ public NamingEnumeration listBindings(Name name) throws NamingException
+ {
+ return listBindings(name.toString());
+ }
+
+ public void bind(Name name, Object obj) throws NamingException
+ {
+ throw new OperationNotSupportedException();
+ }
+
+ public void bind(String name, Object obj) throws NamingException
+ {
+ throw new OperationNotSupportedException();
+ }
+
+ public void close() throws NamingException
+ {
+ // ignore
+ }
+
+ public Context createSubcontext(Name name) throws NamingException
+ {
+ throw new OperationNotSupportedException();
+ }
+
+ public Context createSubcontext(String name) throws NamingException
+ {
+ throw new OperationNotSupportedException();
+ }
+
+ public void destroySubcontext(Name name) throws NamingException
+ {
+ throw new OperationNotSupportedException();
+ }
+
+ public void destroySubcontext(String name) throws NamingException
+ {
+ throw new OperationNotSupportedException();
+ }
+
+ public String getNameInNamespace() throws NamingException
+ {
+ return nameInNamespace;
+ }
+
+ public NameParser getNameParser(Name name) throws NamingException
+ {
+ return NAME_PARSER;
+ }
+
+ public NameParser getNameParser(String name) throws NamingException
+ {
+ return NAME_PARSER;
+ }
+
+ public void rebind(Name name, Object obj) throws NamingException
+ {
+ throw new OperationNotSupportedException();
+ }
+
+ public void rebind(String name, Object obj) throws NamingException
+ {
+ throw new OperationNotSupportedException();
+ }
+
+ public void rename(Name oldName, Name newName) throws NamingException
+ {
+ throw new OperationNotSupportedException();
+ }
+
+ public void rename(String oldName, String newName) throws NamingException
+ {
+ throw new OperationNotSupportedException();
+ }
+
+ public void unbind(Name name) throws NamingException
+ {
+ throw new OperationNotSupportedException();
+ }
+
+ public void unbind(String name) throws NamingException
+ {
+ throw new OperationNotSupportedException();
+ }
+
+ private abstract class LocalNamingEnumeration implements NamingEnumeration
+ {
+ private final Iterator i = bindings.entrySet()
+ .iterator();
+
+ public boolean hasMore() throws NamingException
+ {
+ return i.hasNext();
+ }
+
+ public boolean hasMoreElements()
+ {
+ return i.hasNext();
+ }
+
+ protected Map.Entry getNext()
+ {
+ return (Map.Entry) i.next();
+ }
+
+ public void close() throws NamingException
+ {
+ }
+ }
+
+ private class ListEnumeration extends LocalNamingEnumeration
+ {
+ ListEnumeration()
+ {
+ }
+
+ public Object next() throws NamingException
+ {
+ return nextElement();
+ }
+
+ public Object nextElement()
+ {
+ Map.Entry entry = getNext();
+ return new NameClassPair((String) entry.getKey(), entry.getValue()
+ .getClass()
+ .getName());
+ }
+ }
+
+ private class ListBindingEnumeration extends LocalNamingEnumeration
+ {
+ ListBindingEnumeration()
+ {
+ }
+
+ public Object next() throws NamingException
+ {
+ return nextElement();
+ }
+
+ public Object nextElement()
+ {
+ Map.Entry entry = getNext();
+ return new Binding((String) entry.getKey(), entry.getValue());
+ }
+ }
+}
diff --git a/activemq-jms-server/pom.xml b/activemq-jms-server/pom.xml
index 476914bb0b..c39a31e6b6 100644
--- a/activemq-jms-server/pom.xml
+++ b/activemq-jms-server/pom.xml
@@ -53,10 +53,6 @@
org.jbossjboss-transaction-spi
-
- org.jboss.naming
- jnpserver
-
diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/JMSServerConfigParser.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/JMSServerConfigParser.java
index 3b6bca8457..67d7ef6931 100644
--- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/JMSServerConfigParser.java
+++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/JMSServerConfigParser.java
@@ -18,7 +18,6 @@ package org.apache.activemq.jms.server;
import java.io.InputStream;
-import org.apache.activemq.jms.server.config.ConnectionFactoryConfiguration;
import org.apache.activemq.jms.server.config.JMSConfiguration;
import org.apache.activemq.jms.server.config.JMSQueueConfiguration;
import org.apache.activemq.jms.server.config.TopicConfiguration;
@@ -58,12 +57,4 @@ public interface JMSServerConfigParser
* @throws Exception
*/
JMSQueueConfiguration parseQueueConfiguration(final Node node) throws Exception;
-
- /**
- * Parse the Connection Configuration node as a ConnectionFactoryConfiguration object
- * @param node
- * @return
- * @throws Exception
- */
- ConnectionFactoryConfiguration parseConnectionFactoryConfiguration(final Node node) throws Exception;
}
diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/embedded/EmbeddedJMS.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/embedded/EmbeddedJMS.java
index 376e4ced18..e2d55500f3 100644
--- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/embedded/EmbeddedJMS.java
+++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/embedded/EmbeddedJMS.java
@@ -21,6 +21,7 @@ import javax.naming.Context;
import org.apache.activemq.core.registry.JndiBindingRegistry;
import org.apache.activemq.core.registry.MapBindingRegistry;
import org.apache.activemq.core.server.embedded.EmbeddedActiveMQ;
+import org.apache.activemq.jms.server.JMSServerManager;
import org.apache.activemq.jms.server.config.JMSConfiguration;
import org.apache.activemq.jms.server.impl.JMSServerManagerImpl;
import org.apache.activemq.spi.core.naming.BindingRegistry;
@@ -58,6 +59,11 @@ public class EmbeddedJMS extends EmbeddedActiveMQ
return registry;
}
+ public JMSServerManager getJMSServerManager()
+ {
+ return serverManager;
+ }
+
/**
* Only set this property if you are using a custom BindingRegistry
*
diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerConfigParserImpl.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerConfigParserImpl.java
index 139ffdb32d..cd948c13dd 100644
--- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerConfigParserImpl.java
+++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerConfigParserImpl.java
@@ -20,21 +20,15 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.ArrayList;
-import java.util.List;
import org.apache.activemq.api.config.ActiveMQDefaultConfiguration;
-import org.apache.activemq.api.core.ActiveMQException;
-import org.apache.activemq.api.core.client.ActiveMQClient;
-import org.apache.activemq.api.jms.JMSFactoryType;
import org.apache.activemq.core.config.impl.Validators;
-import org.apache.activemq.jms.server.ActiveMQJMSServerBundle;
import org.apache.activemq.jms.server.ActiveMQJMSServerLogger;
import org.apache.activemq.jms.server.JMSServerConfigParser;
import org.apache.activemq.jms.server.config.ConnectionFactoryConfiguration;
import org.apache.activemq.jms.server.config.JMSConfiguration;
import org.apache.activemq.jms.server.config.JMSQueueConfiguration;
import org.apache.activemq.jms.server.config.TopicConfiguration;
-import org.apache.activemq.jms.server.config.impl.ConnectionFactoryConfigurationImpl;
import org.apache.activemq.jms.server.config.impl.JMSConfigurationImpl;
import org.apache.activemq.jms.server.config.impl.JMSQueueConfigurationImpl;
import org.apache.activemq.jms.server.config.impl.TopicConfigurationImpl;
@@ -85,8 +79,7 @@ public final class JMSServerConfigParserImpl implements JMSServerConfigParser
org.apache.activemq.utils.XMLUtil.validate(rootnode, "schema/activemq-jms.xsd");
String[] elements = new String[]{JMSServerDeployer.QUEUE_NODE_NAME,
- JMSServerDeployer.TOPIC_NODE_NAME,
- JMSServerDeployer.CONNECTION_FACTORY_NODE_NAME};
+ JMSServerDeployer.TOPIC_NODE_NAME};
for (String element : elements)
{
NodeList children = e.getElementsByTagName(element);
@@ -100,11 +93,7 @@ public final class JMSServerConfigParserImpl implements JMSServerConfigParser
continue;
}
- if (node.getNodeName().equals(JMSServerDeployer.CONNECTION_FACTORY_NODE_NAME))
- {
- cfs.add(parseConnectionFactoryConfiguration(node));
- }
- else if (node.getNodeName().equals(JMSServerDeployer.TOPIC_NODE_NAME))
+ if (node.getNodeName().equals(JMSServerDeployer.TOPIC_NODE_NAME))
{
topics.add(parseTopicConfiguration(node));
}
@@ -118,7 +107,7 @@ public final class JMSServerConfigParserImpl implements JMSServerConfigParser
domain = XMLConfigurationUtil.getString(e, JMSServerDeployer.JMX_DOMAIN_NAME, ActiveMQDefaultConfiguration.getDefaultJmxDomain(), Validators.NO_CHECK);
- JMSConfiguration value = newConfig(queues, topics, cfs, domain);
+ JMSConfiguration value = newConfig(queues, topics, domain);
return value;
}
@@ -133,23 +122,8 @@ public final class JMSServerConfigParserImpl implements JMSServerConfigParser
public TopicConfiguration parseTopicConfiguration(final Node node) throws Exception
{
String topicName = node.getAttributes().getNamedItem(JMSServerConfigParserImpl.NAME_ATTR).getNodeValue();
- NodeList children = node.getChildNodes();
- ArrayList jndiNames = new ArrayList();
- for (int i = 0; i < children.getLength(); i++)
- {
- Node child = children.item(i);
-
- if (JMSServerDeployer.ENTRY_NODE_NAME.equals(children.item(i).getNodeName()))
- {
- String jndiElement = child.getAttributes().getNamedItem("name").getNodeValue();
- jndiNames.add(jndiElement);
- }
- }
-
- String[] strBindings = jndiNames.toArray(new String[jndiNames.size()]);
-
- return newTopic(topicName, strBindings);
+ return newTopic(topicName);
}
/**
@@ -167,17 +141,11 @@ public final class JMSServerConfigParserImpl implements JMSServerConfigParser
String selectorString = null;
boolean durable = XMLConfigurationUtil.getBoolean(e, "durable", JMSServerDeployer.DEFAULT_QUEUE_DURABILITY);
NodeList children = node.getChildNodes();
- ArrayList jndiNames = new ArrayList();
for (int i = 0; i < children.getLength(); i++)
{
Node child = children.item(i);
- if (JMSServerDeployer.ENTRY_NODE_NAME.equals(children.item(i).getNodeName()))
- {
- String jndiName = child.getAttributes().getNamedItem("name").getNodeValue();
- jndiNames.add(jndiName);
- }
- else if (JMSServerDeployer.QUEUE_SELECTOR_NODE_NAME.equals(children.item(i).getNodeName()))
+ if (JMSServerDeployer.QUEUE_SELECTOR_NODE_NAME.equals(children.item(i).getNodeName()))
{
Node selectorNode = children.item(i);
Node attNode = selectorNode.getAttributes().getNamedItem("string");
@@ -185,298 +153,19 @@ public final class JMSServerConfigParserImpl implements JMSServerConfigParser
}
}
- String[] jndiArray = jndiNames.toArray(new String[jndiNames.size()]);
- return newQueue(queueName, selectorString, durable, jndiArray);
- }
-
- /**
- * Parse the Connection Configuration node as a ConnectionFactoryConfiguration object
- *
- * @param node
- * @return ConnectionFactoryConfiguration
- * @throws Exception
- */
- public ConnectionFactoryConfiguration parseConnectionFactoryConfiguration(final Node node) throws Exception
- {
- if (!node.getNodeName().equals(JMSServerDeployer.CONNECTION_FACTORY_NODE_NAME))
- {
- // sanity check, this shouldn't ever happen
- throw ActiveMQJMSServerBundle.BUNDLE.invalidNodeParsingCF(node.getNodeName());
- }
- Element e = (Element) node;
-
- String name = node.getAttributes().getNamedItem(JMSServerConfigParserImpl.NAME_ATTR).getNodeValue();
-
- String fact = e.getAttribute("signature");
- boolean isXA = XMLConfigurationUtil.getBoolean(e,
- "xa",
- ActiveMQClient.DEFAULT_XA);
-
- JMSFactoryType factType = resolveFactoryType(fact, isXA);
-
- long clientFailureCheckPeriod = XMLConfigurationUtil.getLong(e,
- "client-failure-check-period",
- ActiveMQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- Validators.MINUS_ONE_OR_GT_ZERO);
- long connectionTTL = XMLConfigurationUtil.getLong(e,
- "connection-ttl",
- ActiveMQClient.DEFAULT_CONNECTION_TTL,
- Validators.MINUS_ONE_OR_GE_ZERO);
- long callTimeout = XMLConfigurationUtil.getLong(e,
- "call-timeout",
- ActiveMQClient.DEFAULT_CALL_TIMEOUT,
- Validators.GE_ZERO);
- long callFailoverTimeout = XMLConfigurationUtil.getLong(e,
- "call-failover-timeout",
- ActiveMQClient.DEFAULT_CALL_FAILOVER_TIMEOUT,
- Validators.MINUS_ONE_OR_GT_ZERO);
- String clientID = XMLConfigurationUtil.getString(e, "client-id", null, Validators.NO_CHECK);
- int dupsOKBatchSize = XMLConfigurationUtil.getInteger(e,
- "dups-ok-batch-size",
- ActiveMQClient.DEFAULT_ACK_BATCH_SIZE,
- Validators.GT_ZERO);
- int transactionBatchSize = XMLConfigurationUtil.getInteger(e,
- "transaction-batch-size",
- ActiveMQClient.DEFAULT_ACK_BATCH_SIZE,
- Validators.GT_ZERO);
- int consumerWindowSize = XMLConfigurationUtil.getInteger(e,
- "consumer-window-size",
- ActiveMQClient.DEFAULT_CONSUMER_WINDOW_SIZE,
- Validators.MINUS_ONE_OR_GE_ZERO);
- int producerWindowSize = XMLConfigurationUtil.getInteger(e,
- "producer-window-size",
- ActiveMQClient.DEFAULT_PRODUCER_WINDOW_SIZE,
- Validators.MINUS_ONE_OR_GT_ZERO);
- int consumerMaxRate = XMLConfigurationUtil.getInteger(e,
- "consumer-max-rate",
- ActiveMQClient.DEFAULT_CONSUMER_MAX_RATE,
- Validators.MINUS_ONE_OR_GT_ZERO);
- int confirmationWindowSize = XMLConfigurationUtil.getInteger(e,
- "confirmation-window-size",
- ActiveMQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE,
- Validators.MINUS_ONE_OR_GT_ZERO);
- int producerMaxRate = XMLConfigurationUtil.getInteger(e,
- "producer-max-rate",
- ActiveMQClient.DEFAULT_PRODUCER_MAX_RATE,
- Validators.MINUS_ONE_OR_GT_ZERO);
- boolean cacheLargeMessagesClient = XMLConfigurationUtil.getBoolean(e,
- "cache-large-message-client",
- ActiveMQClient.DEFAULT_CACHE_LARGE_MESSAGE_CLIENT);
- int minLargeMessageSize = XMLConfigurationUtil.getInteger(e,
- "min-large-message-size",
- ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
- Validators.GT_ZERO);
-
- boolean compressLargeMessages = XMLConfigurationUtil.getBoolean(e,
- "compress-large-messages",
- ActiveMQClient.DEFAULT_COMPRESS_LARGE_MESSAGES);
-
- boolean blockOnAcknowledge = XMLConfigurationUtil.getBoolean(e,
- "block-on-acknowledge",
- ActiveMQClient.DEFAULT_BLOCK_ON_ACKNOWLEDGE);
- boolean blockOnNonDurableSend = XMLConfigurationUtil.getBoolean(e,
- "block-on-non-durable-send",
- ActiveMQClient.DEFAULT_BLOCK_ON_NON_DURABLE_SEND);
- boolean blockOnDurableSend = XMLConfigurationUtil.getBoolean(e,
- "block-on-durable-send",
- ActiveMQClient.DEFAULT_BLOCK_ON_DURABLE_SEND);
- boolean autoGroup = XMLConfigurationUtil.getBoolean(e, "auto-group", ActiveMQClient.DEFAULT_AUTO_GROUP);
- boolean preAcknowledge = XMLConfigurationUtil.getBoolean(e,
- "pre-acknowledge",
- ActiveMQClient.DEFAULT_PRE_ACKNOWLEDGE);
- long retryInterval = XMLConfigurationUtil.getLong(e,
- "retry-interval",
- ActiveMQClient.DEFAULT_RETRY_INTERVAL,
- Validators.GT_ZERO);
- double retryIntervalMultiplier = XMLConfigurationUtil.getDouble(e,
- "retry-interval-multiplier",
- ActiveMQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER,
- Validators.GT_ZERO);
- long maxRetryInterval = XMLConfigurationUtil.getLong(e,
- "max-retry-interval",
- ActiveMQClient.DEFAULT_MAX_RETRY_INTERVAL,
- Validators.GT_ZERO);
- int reconnectAttempts = XMLConfigurationUtil.getInteger(e,
- "reconnect-attempts",
- ActiveMQClient.DEFAULT_RECONNECT_ATTEMPTS,
- Validators.MINUS_ONE_OR_GE_ZERO);
- boolean failoverOnInitialConnection = XMLConfigurationUtil.getBoolean(e,
- "failover-on-initial-connection",
- ActiveMQClient.DEFAULT_FAILOVER_ON_INITIAL_CONNECTION);
-
- boolean useGlobalPools = XMLConfigurationUtil.getBoolean(e,
- "use-global-pools",
- ActiveMQClient.DEFAULT_USE_GLOBAL_POOLS);
- int scheduledThreadPoolMaxSize = XMLConfigurationUtil.getInteger(e,
- "scheduled-thread-pool-max-size",
- ActiveMQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE,
- Validators.MINUS_ONE_OR_GT_ZERO);
- int threadPoolMaxSize = XMLConfigurationUtil.getInteger(e,
- "thread-pool-max-size",
- ActiveMQClient.DEFAULT_THREAD_POOL_MAX_SIZE,
- Validators.MINUS_ONE_OR_GT_ZERO);
- String connectionLoadBalancingPolicyClassName = XMLConfigurationUtil.getString(e,
- "connection-load-balancing-policy-class-name",
- ActiveMQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
- Validators.NOT_NULL_OR_EMPTY);
- boolean ha = XMLConfigurationUtil.getBoolean(e, "ha", ActiveMQClient.DEFAULT_HA);
-
- String groupid = XMLConfigurationUtil.getString(e, "group-id", null, Validators.NO_CHECK);
- List jndiBindings = new ArrayList();
- List connectorNames = new ArrayList();
- String discoveryGroupName = null;
-
- NodeList children = node.getChildNodes();
-
- for (int j = 0; j < children.getLength(); j++)
- {
- Node child = children.item(j);
-
- if (JMSServerDeployer.ENTRIES_NODE_NAME.equals(child.getNodeName()))
- {
- NodeList entries = child.getChildNodes();
- for (int i = 0; i < entries.getLength(); i++)
- {
- Node entry = entries.item(i);
- if (JMSServerDeployer.ENTRY_NODE_NAME.equals(entry.getNodeName()))
- {
- String jndiName = entry.getAttributes().getNamedItem("name").getNodeValue();
-
- jndiBindings.add(jndiName);
- }
- }
- }
- else if (JMSServerDeployer.CONNECTORS_NODE_NAME.equals(child.getNodeName()))
- {
- NodeList entries = child.getChildNodes();
- for (int i = 0; i < entries.getLength(); i++)
- {
- Node entry = entries.item(i);
- if (JMSServerDeployer.CONNECTOR_REF_ELEMENT.equals(entry.getNodeName()))
- {
- String connectorName = entry.getAttributes().getNamedItem("connector-name").getNodeValue();
-
- connectorNames.add(connectorName);
- }
- }
- }
- else if (JMSServerDeployer.DISCOVERY_GROUP_ELEMENT.equals(child.getNodeName()))
- {
- discoveryGroupName = child.getAttributes().getNamedItem("discovery-group-name").getNodeValue();
-
- }
- }
-
- ConnectionFactoryConfiguration cfConfig;
-
- String[] strbindings = jndiBindings.toArray(new String[jndiBindings.size()]);
-
- if (discoveryGroupName != null)
- {
- cfConfig = new ConnectionFactoryConfigurationImpl()
- .setDiscoveryGroupName(discoveryGroupName);
- }
- else
- {
- ArrayList connectors = new ArrayList(connectorNames.size());
- for (String connectorName : connectorNames)
- {
- connectors.add(connectorName);
- }
- cfConfig = new ConnectionFactoryConfigurationImpl()
- .setConnectorNames(connectors);
- }
-
- cfConfig
- .setName(name)
- .setHA(ha)
- .setBindings(strbindings)
- .setFactoryType(factType)
- .setClientID(clientID)
- .setClientFailureCheckPeriod(clientFailureCheckPeriod)
- .setConnectionTTL(connectionTTL)
- .setCallTimeout(callTimeout)
- .setCallFailoverTimeout(callFailoverTimeout)
- .setCacheLargeMessagesClient(cacheLargeMessagesClient)
- .setMinLargeMessageSize(minLargeMessageSize)
- .setCompressLargeMessages(compressLargeMessages)
- .setConsumerWindowSize(consumerWindowSize)
- .setConsumerMaxRate(consumerMaxRate)
- .setConfirmationWindowSize(confirmationWindowSize)
- .setProducerWindowSize(producerWindowSize)
- .setProducerMaxRate(producerMaxRate)
- .setBlockOnAcknowledge(blockOnAcknowledge)
- .setBlockOnDurableSend(blockOnDurableSend)
- .setBlockOnNonDurableSend(blockOnNonDurableSend)
- .setAutoGroup(autoGroup)
- .setPreAcknowledge(preAcknowledge)
- .setLoadBalancingPolicyClassName(connectionLoadBalancingPolicyClassName)
- .setTransactionBatchSize(transactionBatchSize)
- .setDupsOKBatchSize(dupsOKBatchSize)
- .setUseGlobalPools(useGlobalPools)
- .setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize)
- .setThreadPoolMaxSize(threadPoolMaxSize)
- .setRetryInterval(retryInterval)
- .setRetryIntervalMultiplier(retryIntervalMultiplier)
- .setMaxRetryInterval(maxRetryInterval)
- .setReconnectAttempts(reconnectAttempts)
- .setFailoverOnInitialConnection(failoverOnInitialConnection)
- .setGroupID(groupid);
-
- return cfConfig;
- }
-
- private JMSFactoryType resolveFactoryType(String fact, boolean isXA) throws ActiveMQException
- {
- if ("".equals(fact))
- {
- fact = "generic";
- }
- if (isXA)
- {
- if ("generic".equals(fact))
- {
- return JMSFactoryType.XA_CF;
- }
- if ("queue".equals(fact))
- {
- return JMSFactoryType.QUEUE_XA_CF;
- }
- if ("topic".equals(fact))
- {
- return JMSFactoryType.TOPIC_XA_CF;
- }
- }
- else
- {
- if ("generic".equals(fact))
- {
- return JMSFactoryType.CF;
- }
- if ("queue".equals(fact))
- {
- return JMSFactoryType.QUEUE_CF;
- }
- if ("topic".equals(fact))
- {
- return JMSFactoryType.TOPIC_CF;
- }
- }
- throw ActiveMQJMSServerBundle.BUNDLE.invalidSignatureParsingCF(fact);
+ return newQueue(queueName, selectorString, durable);
}
/**
* hook for integration layers
*
* @param topicName
- * @param strBindings
* @return
*/
- protected TopicConfiguration newTopic(final String topicName, final String[] strBindings)
+ protected TopicConfiguration newTopic(final String topicName)
{
return new TopicConfigurationImpl()
- .setName(topicName)
- .setBindings(strBindings);
+ .setName(topicName);
}
/**
@@ -485,19 +174,16 @@ public final class JMSServerConfigParserImpl implements JMSServerConfigParser
* @param queueName
* @param selectorString
* @param durable
- * @param jndiArray
* @return
*/
protected JMSQueueConfiguration newQueue(final String queueName,
final String selectorString,
- final boolean durable,
- final String[] jndiArray)
+ final boolean durable)
{
return new JMSQueueConfigurationImpl().
setName(queueName).
setSelector(selectorString).
- setDurable(durable).
- setBindings(jndiArray);
+ setDurable(durable);
}
/**
@@ -505,16 +191,13 @@ public final class JMSServerConfigParserImpl implements JMSServerConfigParser
*
* @param queues
* @param topics
- * @param cfs
* @param domain
* @return
*/
protected JMSConfiguration newConfig(final ArrayList queues,
- final ArrayList topics,
- final ArrayList cfs, String domain)
+ final ArrayList topics, String domain)
{
return new JMSConfigurationImpl()
- .setConnectionFactoryConfigurations(cfs)
.setQueueConfigurations(queues)
.setTopicConfigurations(topics)
.setDomain(domain);
diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerDeployer.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerDeployer.java
index eaa2bec5b1..eab54a6869 100644
--- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerDeployer.java
+++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerDeployer.java
@@ -20,7 +20,6 @@ import org.apache.activemq.core.deployers.DeploymentManager;
import org.apache.activemq.core.deployers.impl.XmlDeployer;
import org.apache.activemq.jms.server.JMSServerConfigParser;
import org.apache.activemq.jms.server.JMSServerManager;
-import org.apache.activemq.jms.server.config.ConnectionFactoryConfiguration;
import org.apache.activemq.jms.server.config.JMSQueueConfiguration;
import org.apache.activemq.jms.server.config.TopicConfiguration;
import org.w3c.dom.Node;
@@ -36,18 +35,6 @@ public class JMSServerDeployer extends XmlDeployer
private final JMSServerManager jmsServerManager;
- protected static final String CONNECTOR_REF_ELEMENT = "connector-ref";
-
- protected static final String DISCOVERY_GROUP_ELEMENT = "discovery-group-ref";
-
- protected static final String ENTRIES_NODE_NAME = "entries";
-
- protected static final String ENTRY_NODE_NAME = "entry";
-
- protected static final String CONNECTORS_NODE_NAME = "connectors";
-
- protected static final String CONNECTION_FACTORY_NODE_NAME = "connection-factory";
-
protected static final String QUEUE_NODE_NAME = "queue";
protected static final String QUEUE_SELECTOR_NODE_NAME = "selector";
@@ -77,8 +64,7 @@ public class JMSServerDeployer extends XmlDeployer
public String[] getElementTagName()
{
return new String[]{JMSServerDeployer.QUEUE_NODE_NAME,
- JMSServerDeployer.TOPIC_NODE_NAME,
- JMSServerDeployer.CONNECTION_FACTORY_NODE_NAME};
+ JMSServerDeployer.TOPIC_NODE_NAME};
}
@Override
@@ -100,19 +86,14 @@ public class JMSServerDeployer extends XmlDeployer
}
/**
- * Creates the object to bind, this will either be a JBossConnectionFActory, ActiveMQQueue or
- * ActiveMQTopic.
+ * Creates the object to bind, this will either be a ActiveMQQueue or ActiveMQTopic.
*
* @param node the config
* @throws Exception
*/
private void createAndBindObject(final Node node) throws Exception
{
- if (node.getNodeName().equals(JMSServerDeployer.CONNECTION_FACTORY_NODE_NAME))
- {
- deployConnectionFactory(node);
- }
- else if (node.getNodeName().equals(JMSServerDeployer.QUEUE_NODE_NAME))
+ if (node.getNodeName().equals(JMSServerDeployer.QUEUE_NODE_NAME))
{
deployQueue(node);
}
@@ -131,12 +112,7 @@ public class JMSServerDeployer extends XmlDeployer
@Override
public void undeploy(final Node node) throws Exception
{
- if (node.getNodeName().equals(JMSServerDeployer.CONNECTION_FACTORY_NODE_NAME))
- {
- String cfName = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
- jmsServerManager.destroyConnectionFactory(cfName);
- }
- else if (node.getNodeName().equals(JMSServerDeployer.QUEUE_NODE_NAME))
+ if (node.getNodeName().equals(JMSServerDeployer.QUEUE_NODE_NAME))
{
String queueName = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
jmsServerManager.removeQueueFromJNDI(queueName);
@@ -162,7 +138,7 @@ public class JMSServerDeployer extends XmlDeployer
private void deployTopic(final Node node) throws Exception
{
TopicConfiguration topicConfig = parser.parseTopicConfiguration(node);
- jmsServerManager.createTopic(false, topicConfig.getName(), topicConfig.getBindings());
+ jmsServerManager.createTopic(false, topicConfig.getName());
}
/**
@@ -172,18 +148,6 @@ public class JMSServerDeployer extends XmlDeployer
private void deployQueue(final Node node) throws Exception
{
JMSQueueConfiguration queueconfig = parser.parseQueueConfiguration(node);
- jmsServerManager.createQueue(false, queueconfig.getName(), queueconfig.getSelector(), queueconfig.isDurable(), queueconfig.getBindings());
+ jmsServerManager.createQueue(false, queueconfig.getName(), queueconfig.getSelector(), queueconfig.isDurable());
}
-
- /**
- * @param node
- * @throws Exception
- */
- private void deployConnectionFactory(final Node node) throws Exception
- {
- ConnectionFactoryConfiguration cfConfig = parser.parseConnectionFactoryConfiguration(node);
- jmsServerManager.createConnectionFactory(false, cfConfig, cfConfig.getBindings());
- }
-
-
}
diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerManagerImpl.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerManagerImpl.java
index 392a19b59d..3261033370 100644
--- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerManagerImpl.java
+++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerManagerImpl.java
@@ -481,7 +481,10 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
{
if (!contextSet)
{
- registry = new JndiBindingRegistry(new InitialContext());
+ if (System.getProperty(Context.INITIAL_CONTEXT_FACTORY) != null)
+ {
+ registry = new JndiBindingRegistry(new InitialContext());
+ }
}
}
@@ -1731,10 +1734,9 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
private void checkJNDI(final String... jndiNames) throws NamingException
{
-
for (String jndiName : jndiNames)
{
- if (registry.lookup(jndiName) != null)
+ if (registry != null && registry.lookup(jndiName) != null)
{
throw new NamingException(jndiName + " already has an object bound");
}
@@ -1772,15 +1774,13 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
List queueConfigs = config.getQueueConfigurations();
for (JMSQueueConfiguration qConfig : queueConfigs)
{
- String[] bindings = qConfig.getBindings();
- createQueue(false, qConfig.getName(), qConfig.getSelector(), qConfig.isDurable(), bindings);
+ createQueue(false, qConfig.getName(), qConfig.getSelector(), qConfig.isDurable(), qConfig.getBindings());
}
List topicConfigs = config.getTopicConfigurations();
for (TopicConfiguration tConfig : topicConfigs)
{
- String[] bindings = tConfig.getBindings();
- createTopic(false, tConfig.getName(), bindings);
+ createTopic(false, tConfig.getName(), tConfig.getBindings());
}
}
diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/StandaloneNamingServer.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/StandaloneNamingServer.java
deleted file mode 100644
index 9d029a22f5..0000000000
--- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/StandaloneNamingServer.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.jms.server.impl;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import org.apache.activemq.core.server.ActivateCallback;
-import org.apache.activemq.core.server.ActiveMQComponent;
-import org.apache.activemq.core.server.ActiveMQServer;
-import org.apache.activemq.core.server.ActiveMQServerLogger;
-import org.jnp.server.Main;
-import org.jnp.server.NamingBeanImpl;
-
-/**
- * This server class is only used in the standalone mode, its used to control the life cycle of the Naming Server to allow
- * it to be activated and deactivated
- *
- * @author Andy Taylor
- * 11/8/12
- */
-public class StandaloneNamingServer implements ActiveMQComponent
-{
- private Main jndiServer;
-
- private ActiveMQServer server;
-
- private NamingBeanImpl namingBean;
-
- private int port = 1099;
-
- private String bindAddress = "localhost";
-
- private int rmiPort = 1098;
-
- private String rmiBindAddress = "localhost";
-
- private ExecutorService executor;
-
- public StandaloneNamingServer(ActiveMQServer server)
- {
- this.server = server;
- }
-
- @Override
- public void start() throws Exception
- {
- server.registerActivateCallback(new ServerActivateCallback());
- }
-
- @Override
- public void stop() throws Exception
- {
- }
-
- @Override
- public boolean isStarted()
- {
- return false;
- }
-
- public void setPort(int port)
- {
- this.port = port;
- }
-
- public void setBindAddress(String bindAddress)
- {
- this.bindAddress = bindAddress;
- }
-
- public void setRmiPort(int rmiPort)
- {
- this.rmiPort = rmiPort;
- }
-
- public void setRmiBindAddress(String rmiBindAddress)
- {
- this.rmiBindAddress = rmiBindAddress;
- }
-
- private class ServerActivateCallback implements ActivateCallback
- {
- private boolean activated = false;
-
- @Override
- public synchronized void preActivate()
- {
- if (activated)
- {
- return;
- }
- try
- {
- jndiServer = new Main();
- namingBean = new NamingBeanImpl();
- jndiServer.setNamingInfo(namingBean);
- executor = Executors.newCachedThreadPool();
- jndiServer.setLookupExector(executor);
- jndiServer.setPort(port);
- jndiServer.setBindAddress(bindAddress);
- jndiServer.setRmiPort(rmiPort);
- jndiServer.setRmiBindAddress(rmiBindAddress);
- namingBean.start();
- jndiServer.start();
- }
- catch (Exception e)
- {
- ActiveMQServerLogger.LOGGER.unableToStartNamingServer(e);
- }
-
- activated = true;
- }
-
- @Override
- public void activated()
- {
-
- }
-
- @Override
- public synchronized void deActivate()
- {
- if (!activated)
- {
- return;
- }
- if (jndiServer != null)
- {
- try
- {
- jndiServer.stop();
- }
- catch (Exception e)
- {
- ActiveMQServerLogger.LOGGER.unableToStopNamingServer(e);
- }
- }
- if (namingBean != null)
- {
- namingBean.stop();
- }
- if (executor != null)
- {
- executor.shutdown();
- }
- activated = false;
- }
-
- @Override
- public void activationComplete()
- {
-
- }
- }
-}
diff --git a/activemq-jms-server/src/main/resources/schema/activemq-jms.xsd b/activemq-jms-server/src/main/resources/schema/activemq-jms.xsd
index 7367b15b8c..b3d2cdfe9b 100644
--- a/activemq-jms-server/src/main/resources/schema/activemq-jms.xsd
+++ b/activemq-jms-server/src/main/resources/schema/activemq-jms.xsd
@@ -9,259 +9,37 @@
version="1.0">
-
-
+
+
-
-
-
-
+
+
+
-
-
+
+
-
-
- a list of connection factories to create and add to
- JNDI
-
-
-
-
-
- Whether this is an XA connection factory
-
-
-
-
+
-
-
- A sequence of connectors used by the connection factory
-
-
-
-
-
-
- A connector reference
-
-
-
-
-
- Name of the connector to connect to the live server
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- the period (in ms) after which the client will consider the connection failed
- after not receiving packets from the server. -1 disables this setting.
-
-
-
-
-
-
- the time to live (in ms) for connections
-
-
-
-
-
-
-
- the timeout (in ms) for remote calls
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- the pre-configured client ID for the connection factory
-
-
-
-
-
-
-
-
-
-
-
- whether or not messages are acknowledged synchronously
-
-
-
-
-
-
- whether or not non-durable messages are sent synchronously
-
-
-
-
-
-
- whether or not durable messages are sent synchronously
-
-
-
-
-
- whether or not message grouping is automatically used
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Type of connection factory
-
-
-
-
-
-
-
-
-
-
-
-
-
- Name of discovery group used by this connection factory
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
diff --git a/activemq-ra/pom.xml b/activemq-ra/pom.xml
index c027026640..c1fca0503c 100644
--- a/activemq-ra/pom.xml
+++ b/activemq-ra/pom.xml
@@ -46,6 +46,13 @@
activemq-jms-server${project.version}provided
+
+
+
+ org.jboss.spec.javax.resource
+ jboss-connector-api_1.5_spec
+
+ org.apache.geronimo.specs
diff --git a/activemq-rest/src/main/java/org/apache/activemq/rest/integration/EmbeddedRestActiveMQJMS.java b/activemq-rest/src/main/java/org/apache/activemq/rest/integration/EmbeddedRestActiveMQJMS.java
index 40140300ea..ee48d51ac6 100644
--- a/activemq-rest/src/main/java/org/apache/activemq/rest/integration/EmbeddedRestActiveMQJMS.java
+++ b/activemq-rest/src/main/java/org/apache/activemq/rest/integration/EmbeddedRestActiveMQJMS.java
@@ -37,4 +37,8 @@ public class EmbeddedRestActiveMQJMS extends EmbeddedRestActiveMQ
return ((EmbeddedJMS) embeddedActiveMQ).getRegistry();
}
+ public EmbeddedJMS getEmbeddedJMS()
+ {
+ return (EmbeddedJMS) embeddedActiveMQ;
+ }
}
diff --git a/activemq-rest/src/main/java/org/apache/activemq/rest/queue/QueueDestinationsResource.java b/activemq-rest/src/main/java/org/apache/activemq/rest/queue/QueueDestinationsResource.java
index 259826e71e..0358db173b 100644
--- a/activemq-rest/src/main/java/org/apache/activemq/rest/queue/QueueDestinationsResource.java
+++ b/activemq-rest/src/main/java/org/apache/activemq/rest/queue/QueueDestinationsResource.java
@@ -101,13 +101,6 @@ public class QueueDestinationsResource
{
}
}
- if (queue.getBindings() != null && queue.getBindings().length > 0 && manager.getRegistry() != null)
- {
- for (String binding : queue.getBindings())
- {
- manager.getRegistry().bind(binding, activeMQQueue);
- }
- }
URI uri = uriInfo.getRequestUriBuilder().path(queueName).build();
return Response.created(uri).build();
}
diff --git a/activemq-rest/src/main/java/org/apache/activemq/rest/topic/TopicDestinationsResource.java b/activemq-rest/src/main/java/org/apache/activemq/rest/topic/TopicDestinationsResource.java
index fa3415bdcb..8ab2a0e1a6 100644
--- a/activemq-rest/src/main/java/org/apache/activemq/rest/topic/TopicDestinationsResource.java
+++ b/activemq-rest/src/main/java/org/apache/activemq/rest/topic/TopicDestinationsResource.java
@@ -95,13 +95,6 @@ public class TopicDestinationsResource
{
}
}
- if (topic.getBindings() != null && topic.getBindings().length > 0 && manager.getRegistry() != null)
- {
- for (String binding : topic.getBindings())
- {
- manager.getRegistry().bind(binding, activeMQTopic);
- }
- }
URI uri = uriInfo.getRequestUriBuilder().path(topicName).build();
return Response.created(uri).build();
}
diff --git a/activemq-rest/src/test/java/org/apache/activemq/rest/test/EmbeddedTest.java b/activemq-rest/src/test/java/org/apache/activemq/rest/test/EmbeddedTest.java
index da0d9eaa6c..1ab39d4ed2 100644
--- a/activemq-rest/src/test/java/org/apache/activemq/rest/test/EmbeddedTest.java
+++ b/activemq-rest/src/test/java/org/apache/activemq/rest/test/EmbeddedTest.java
@@ -23,7 +23,10 @@ import javax.jms.MessageProducer;
import javax.jms.ObjectMessage;
import javax.jms.Session;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.activemq.api.jms.JMSFactoryType;
import org.apache.activemq.rest.HttpHeaderProperty;
import org.apache.activemq.rest.integration.EmbeddedRestActiveMQJMS;
import org.apache.activemq.spi.core.naming.BindingRegistry;
@@ -49,6 +52,9 @@ public class EmbeddedTest
server = new EmbeddedRestActiveMQJMS();
server.getManager().setConfigResourcePath("activemq-rest.xml");
server.start();
+ List connectors = new ArrayList<>();
+ connectors.add("in-vm");
+ server.getEmbeddedJMS().getJMSServerManager().createConnectionFactory("ConnectionFactory", false, JMSFactoryType.CF, connectors, "ConnectionFactory");
}
@AfterClass
@@ -61,10 +67,10 @@ public class EmbeddedTest
public static void publish(String destination, Serializable object, String contentType) throws Exception
{
BindingRegistry reg = server.getRegistry();
- Destination dest = (Destination) reg.lookup(destination);
ConnectionFactory factory = (ConnectionFactory) reg.lookup("ConnectionFactory");
Connection conn = factory.createConnection();
Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ Destination dest = session.createQueue(destination);
try
{
@@ -109,7 +115,7 @@ public class EmbeddedTest
TransformTest.Order order = new TransformTest.Order();
order.setName("1");
order.setAmount("$5.00");
- publish("/queue/exampleQueue", order, null);
+ publish("exampleQueue", order, null);
ClientResponse> res = consumeNext.request().header("Accept-Wait", "2").accept("application/xml").post(String.class);
Assert.assertEquals(200, res.getStatus());
@@ -126,7 +132,7 @@ public class EmbeddedTest
TransformTest.Order order = new TransformTest.Order();
order.setName("1");
order.setAmount("$5.00");
- publish("/queue/exampleQueue", order, null);
+ publish("exampleQueue", order, null);
ClientResponse> res = consumeNext.request().header("Accept-Wait", "2").accept("application/json").post(String.class);
Assert.assertEquals(200, res.getStatus());
@@ -143,7 +149,7 @@ public class EmbeddedTest
TransformTest.Order order = new TransformTest.Order();
order.setName("2");
order.setAmount("$15.00");
- publish("/queue/exampleQueue", order, "application/xml");
+ publish("exampleQueue", order, "application/xml");
ClientResponse> res = consumeNext.request().header("Accept-Wait", "2").post(String.class);
Assert.assertEquals(200, res.getStatus());
diff --git a/activemq-rest/src/test/resources/activemq-jms.xml b/activemq-rest/src/test/resources/activemq-jms.xml
index bce97ab150..37589895ef 100644
--- a/activemq-rest/src/test/resources/activemq-jms.xml
+++ b/activemq-rest/src/test/resources/activemq-jms.xml
@@ -1,19 +1,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/distribution/activemq/pom.xml b/distribution/activemq/pom.xml
index c0e58459f3..7911837404 100644
--- a/distribution/activemq/pom.xml
+++ b/distribution/activemq/pom.xml
@@ -101,11 +101,6 @@
org.apache.activemqactivemq-aerogear-integration${project.version}
-
-
- org.apache.activemq
- jnp-client
- ${project.version}org.apache.activemq
diff --git a/distribution/activemq/src/main/assembly/dep.xml b/distribution/activemq/src/main/assembly/dep.xml
index a4c17ac0a5..088ae95728 100644
--- a/distribution/activemq/src/main/assembly/dep.xml
+++ b/distribution/activemq/src/main/assembly/dep.xml
@@ -33,7 +33,6 @@
org.apache.activemq.rest:activemq-restorg.jboss.spec.javax.jms:jboss-jms-api_2.0_spec
- org.jboss.naming:jnpserverorg.jboss.logmanager:jboss-logmanagerorg.jboss:jboss-common-coreio.netty:netty-all
diff --git a/distribution/activemq/src/main/resources/bin/activemq b/distribution/activemq/src/main/resources/bin/activemq
index 1e632d5a62..d8e01f1451 100755
--- a/distribution/activemq/src/main/resources/bin/activemq
+++ b/distribution/activemq/src/main/resources/bin/activemq
@@ -81,7 +81,7 @@ for i in `ls $ACTIVEMQ_HOME/lib/*.jar`; do
done
-JAVA_ARGS="-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces -Dactivemq.home=$ACTIVEMQ_HOME -Ddata.dir=$ACTIVEMQ_HOME/data -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dlogging.configuration=file:$ACTIVEMQ_HOME/config/logging.properties -Djava.library.path=$ACTIVEMQ_HOME/bin/lib/linux-i686:$ACTIVEMQ_HOME/bin/lib/linux-x86_64"
-#JAVA_ARGS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces"
+JAVA_ARGS="-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Dactivemq.home=$ACTIVEMQ_HOME -Ddata.dir=$ACTIVEMQ_HOME/data -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dlogging.configuration=file:$ACTIVEMQ_HOME/config/logging.properties -Djava.library.path=$ACTIVEMQ_HOME/bin/lib/linux-i686:$ACTIVEMQ_HOME/bin/lib/linux-x86_64"
+#JAVA_ARGS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"
exec "$JAVACMD" $JAVA_ARGS -classpath $CLASSPATH org.apache.activemq.cli.ActiveMQ $@
\ No newline at end of file
diff --git a/distribution/activemq/src/main/resources/bin/activemq.cmd b/distribution/activemq/src/main/resources/bin/activemq.cmd
index 32dbb36c75..3a0a4f96d0 100755
--- a/distribution/activemq/src/main/resources/bin/activemq.cmd
+++ b/distribution/activemq/src/main/resources/bin/activemq.cmd
@@ -31,7 +31,7 @@ echo.
:RUN_JAVA
-if "%JVM_FLAGS%" == "" set JVM_FLAGS=-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces -Dactivemq.home=$ACTIVEMQ_HOME -Ddata.dir=$ACTIVEMQ_HOME/data -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dlogging.configuration="file:%ACTIVEMQ_HOME%\config\logging.properties" -Djava.library.path="%ACTIVEMQ_HOME%/bin/lib/linux-i686:%ACTIVEMQ_HOME%/bin/lib/linux-x86_64"
+if "%JVM_FLAGS%" == "" set JVM_FLAGS=-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Dactivemq.home=$ACTIVEMQ_HOME -Ddata.dir=$ACTIVEMQ_HOME/data -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dlogging.configuration="file:%ACTIVEMQ_HOME%\config\logging.properties" -Djava.library.path="%ACTIVEMQ_HOME%/bin/lib/linux-i686:%ACTIVEMQ_HOME%/bin/lib/linux-x86_64"
if "x%ACTIVEMQ_OPTS%" == "x" goto noACTIVEMQ_OPTS
set JVM_FLAGS=%JVM_FLAGS% %ACTIVEMQ_OPTS%
diff --git a/distribution/activemq/src/main/resources/config/clustered/activemq-jms.xml b/distribution/activemq/src/main/resources/config/clustered/activemq-jms.xml
index d1b456b679..ccdc8bd207 100644
--- a/distribution/activemq/src/main/resources/config/clustered/activemq-jms.xml
+++ b/distribution/activemq/src/main/resources/config/clustered/activemq-jms.xml
@@ -2,52 +2,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd">
-
- true
-
-
-
-
-
-
-
+
-
- false
-
-
-
-
-
-
-
-
-
- true
-
-
-
-
-
-
-
-
-
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/distribution/activemq/src/main/resources/config/clustered/jndi.properties b/distribution/activemq/src/main/resources/config/clustered/jndi.properties
deleted file mode 100644
index e2a9832f8e..0000000000
--- a/distribution/activemq/src/main/resources/config/clustered/jndi.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
diff --git a/distribution/activemq/src/main/resources/config/non-clustered/activemq-jms.xml b/distribution/activemq/src/main/resources/config/non-clustered/activemq-jms.xml
index d1b456b679..ccdc8bd207 100644
--- a/distribution/activemq/src/main/resources/config/non-clustered/activemq-jms.xml
+++ b/distribution/activemq/src/main/resources/config/non-clustered/activemq-jms.xml
@@ -2,52 +2,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd">
-
- true
-
-
-
-
-
-
-
+
-
- false
-
-
-
-
-
-
-
-
-
- true
-
-
-
-
-
-
-
-
-
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/distribution/activemq/src/main/resources/config/non-clustered/jndi.properties b/distribution/activemq/src/main/resources/config/non-clustered/jndi.properties
deleted file mode 100644
index e2a9832f8e..0000000000
--- a/distribution/activemq/src/main/resources/config/non-clustered/jndi.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
diff --git a/distribution/activemq/src/main/resources/config/replicated/activemq-configuration.xml b/distribution/activemq/src/main/resources/config/replicated/activemq-configuration.xml
index 5f41085a35..a7a756e5b6 100644
--- a/distribution/activemq/src/main/resources/config/replicated/activemq-configuration.xml
+++ b/distribution/activemq/src/main/resources/config/replicated/activemq-configuration.xml
@@ -3,7 +3,7 @@
xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
${data.dir:../data}/paging
diff --git a/distribution/activemq/src/main/resources/config/replicated/activemq-jms.xml b/distribution/activemq/src/main/resources/config/replicated/activemq-jms.xml
index d1b456b679..ccdc8bd207 100644
--- a/distribution/activemq/src/main/resources/config/replicated/activemq-jms.xml
+++ b/distribution/activemq/src/main/resources/config/replicated/activemq-jms.xml
@@ -2,52 +2,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd">
-
- true
-
-
-
-
-
-
-
+
-
- false
-
-
-
-
-
-
-
-
-
- true
-
-
-
-
-
-
-
-
-
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/distribution/activemq/src/main/resources/config/replicated/jndi.properties b/distribution/activemq/src/main/resources/config/replicated/jndi.properties
deleted file mode 100644
index e2a9832f8e..0000000000
--- a/distribution/activemq/src/main/resources/config/replicated/jndi.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
diff --git a/distribution/activemq/src/main/resources/config/shared-store/activemq-configuration.xml b/distribution/activemq/src/main/resources/config/shared-store/activemq-configuration.xml
index e738d2f3bd..e5820e1687 100644
--- a/distribution/activemq/src/main/resources/config/shared-store/activemq-configuration.xml
+++ b/distribution/activemq/src/main/resources/config/shared-store/activemq-configuration.xml
@@ -3,7 +3,7 @@
xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
${data.dir:../data}/paging
diff --git a/distribution/activemq/src/main/resources/config/shared-store/activemq-jms.xml b/distribution/activemq/src/main/resources/config/shared-store/activemq-jms.xml
index d1b456b679..ccdc8bd207 100644
--- a/distribution/activemq/src/main/resources/config/shared-store/activemq-jms.xml
+++ b/distribution/activemq/src/main/resources/config/shared-store/activemq-jms.xml
@@ -2,52 +2,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd">
-
- true
-
-
-
-
-
-
-
+
-
- false
-
-
-
-
-
-
-
-
-
- true
-
-
-
-
-
-
-
-
-
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/distribution/activemq/src/main/resources/config/shared-store/jndi.properties b/distribution/activemq/src/main/resources/config/shared-store/jndi.properties
deleted file mode 100644
index e2a9832f8e..0000000000
--- a/distribution/activemq/src/main/resources/config/shared-store/jndi.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
diff --git a/distribution/jnp-client/pom.xml b/distribution/jnp-client/pom.xml
deleted file mode 100644
index 122880cae4..0000000000
--- a/distribution/jnp-client/pom.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-
- 4.0.0
-
-
-
- org.apache.activemq
- activemq-distribution
- 6.0.0-SNAPSHOT
-
-
- jnp-client
- jar
- JBoss jnp client jar
-
-
-
- org.jboss.naming
- jnpserver
-
-
- org.jboss.logging
- jboss-logging
-
-
-
-
-
-
- src/main/resources
- true
-
-
-
-
- org.apache.maven.plugins
- maven-shade-plugin
-
-
- package
-
- shade
-
-
-
-
- org.jboss.naming:jnpserver
- org.jboss.logging:jboss-logging
-
-
-
-
- org.jboss.naming:jnpserver
-
- org/jnp/interfaces/**/*.class
- org/jboss/naming/**/*.class
- org/jnp/server/NamingServer_Stub.class
-
-
-
- org.jboss.logging:jboss-logging
-
- org/jboss/logging/**/*.class
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/distribution/pom.xml b/distribution/pom.xml
index 143b72fb82..6e0c42b3e9 100644
--- a/distribution/pom.xml
+++ b/distribution/pom.xml
@@ -22,10 +22,6 @@
org.jboss.spec.javax.jmsjboss-jms-api_2.0_spec
-
- org.jboss.naming
- jnpserver
- io.nettynetty-all
@@ -33,7 +29,6 @@
- jnp-clientactivemq
diff --git a/docs/user-manual/en/appserver-integration.xml b/docs/user-manual/en/appserver-integration.xml
index a22d95e950..897de10d6e 100644
--- a/docs/user-manual/en/appserver-integration.xml
+++ b/docs/user-manual/en/appserver-integration.xml
@@ -494,38 +494,35 @@ public class MyMDB implements MessageListener
-
- DiscoveryInitialWaitTimeout
-
+ DiscoveryInitialWaitTimeout
LongThe initial time to wait for discovery.
-
- ConnectionLoadBalancingPolicyClassName
+ ConnectionLoadBalancingPolicyClassName
StringThe load balancing policy class to use.
- ConnectionTTL
+ ConnectionTTL
LongThe time to live (in milliseconds) for the connection.
- CallTimeout
+ CallTimeout
Longthe call timeout (in milliseconds) for each packet sent.
- DupsOKBatchSize
+ DupsOKBatchSize
Integerthe batch size (in bytes) between acknowledgements when using
@@ -533,7 +530,7 @@ public class MyMDB implements MessageListener
- TransactionBatchSize
+ TransactionBatchSize
Integerthe batch size (in bytes) between acknowledgements when using a
@@ -541,70 +538,70 @@ public class MyMDB implements MessageListener
- ConsumerWindowSize
+ ConsumerWindowSize
Integerthe window size (in bytes) for consumer flow control
- ConsumerMaxRate
+ ConsumerMaxRate
Integerthe fastest rate a consumer may consume messages per second
- ConfirmationWindowSize
+ ConfirmationWindowSize
Integerthe window size (in bytes) for reattachment confirmations
- ProducerMaxRate
+ ProducerMaxRate
Integerthe maximum rate of messages per second that can be sent
- MinLargeMessageSize
+ MinLargeMessageSize
Integerthe size (in bytes) before a message is treated as large
- BlockOnAcknowledge
+ BlockOnAcknowledge
Booleanwhether or not messages are acknowledged synchronously
- BlockOnNonDurableSend
+ BlockOnNonDurableSend
Booleanwhether or not non-durable messages are sent synchronously
- BlockOnDurableSend
+ BlockOnDurableSend
Booleanwhether or not durable messages are sent synchronously
- AutoGroup
+ AutoGroup
Booleanwhether or not message grouping is automatically used
- PreAcknowledge
+ PreAcknowledge
Booleanwhether messages are pre acknowledged by the server before
@@ -612,28 +609,28 @@ public class MyMDB implements MessageListener
- ReconnectAttempts
+ ReconnectAttempts
Integermaximum number of retry attempts, default for the resource adapter is -1 (infinite attempts)
- RetryInterval
+ RetryInterval
Longthe time (in milliseconds) to retry a connection after failing
- RetryIntervalMultiplier
+ RetryIntervalMultiplier
Doublemultiplier to apply to successive retry intervals
- FailoverOnServerShutdown
+ FailoverOnServerShutdown
BooleanIf true client will reconnect to another server if
@@ -641,14 +638,14 @@ public class MyMDB implements MessageListener
- ClientID
+ ClientID
Stringthe pre-configured client ID for the connection factory
- ClientFailureCheckPeriod
+ ClientFailureCheckPeriod
Longthe period (in ms) after which the client will consider the
@@ -657,21 +654,21 @@ public class MyMDB implements MessageListener
- UseGlobalPools
+ UseGlobalPools
Booleanwhether or not to use a global thread pool for threads
- ScheduledThreadPoolMaxSize
+ ScheduledThreadPoolMaxSize
Integerthe size of the scheduled thread pool
- ThreadPoolMaxSize
+ ThreadPoolMaxSize
Integerthe size of the thread pool
diff --git a/docs/user-manual/en/client-classpath.xml b/docs/user-manual/en/client-classpath.xml
index 0115770635..2baafbd523 100644
--- a/docs/user-manual/en/client-classpath.xml
+++ b/docs/user-manual/en/client-classpath.xml
@@ -47,12 +47,5 @@
needed for the javax.jms.* classes. If you already have a jar
with these interface classes on your classpath, you will not need it.
-
-
-
- JMS Client with JNDI
- If you are looking up JMS resources from the JNDI server co-located with the ActiveMQ
- standalone server, you will also need the jar jnp-client.jar jar on
- your client classpath as well as any other jars mentioned previously.
diff --git a/docs/user-manual/en/client-reconnection.xml b/docs/user-manual/en/client-reconnection.xml
index 29a4266b96..96a45345ab 100644
--- a/docs/user-manual/en/client-reconnection.xml
+++ b/docs/user-manual/en/client-reconnection.xml
@@ -115,23 +115,16 @@
default value is 0.
- If you're using JMS, and you're using the JMS Service on the server to load your JMS
- connection factory instances directly into JNDI, then you can specify these parameters
- in the xml configuration in activemq-jms.xml, for example:
+ If you're using JMS and you're using JNDI on the client to look up your JMS
+ connection factory instances then you can specify these parameters
+ in the JNDI context environment in, e.g. jndi.properties:
-<connection-factory name="ConnectionFactory">
- <connectors>
- <connector-ref connector-name="netty"/>
- </connectors>
- <entries>
- <entry name="ConnectionFactory"/>
- <entry name="XAConnectionFactory"/>
- </entries>
- <retry-interval>1000</retry-interval>
- <retry-interval-multiplier>1.5</retry-interval-multiplier>
- <max-retry-interval>60000</max-retry-interval>
- <reconnect-attempts>1000</reconnect-attempts>
-</connection-factory>
+java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url = tcp://localhost:5445
+connection.ConnectionFactory.retryInterval=1000
+connection.ConnectionFactory.retryIntervalMultiplier=1.5
+connection.ConnectionFactory.maxRetryInterval=60000
+connection.ConnectionFactory.reconnectAttempts=1000
If you're using JMS, but instantiating your JMS connection factory directly, you can
specify the parameters using the appropriate setter methods on the ActiveMQConnectionFactory immediately after creating it.
diff --git a/docs/user-manual/en/clusters.xml b/docs/user-manual/en/clusters.xml
index 6d4227e495..2b4aad1c3d 100644
--- a/docs/user-manual/en/clusters.xml
+++ b/docs/user-manual/en/clusters.xml
@@ -378,18 +378,15 @@
whether you're using JMS or the core API.
Configuring client discovery using JMS
- If you're using JMS and you're also using the JMS Service on the server to
- load your JMS connection factory instances into JNDI, then you can specify which
- discovery group to use for your JMS connection factory in the server side xml
- configuration activemq-jms.xml. Let's take a look at an
+ If you're using JMS and you're using JNDI on the client to look up your JMS
+ connection factory instances then you can specify these parameters in the JNDI
+ context environment. e.g. in jndi.properties. Simply ensure the
+ host:port combination matches the group-address and group-port from the corresponding
+ broadcast-group on the server. Let's take a look at an
example:
-<connection-factory name="ConnectionFactory">
- <discovery-group-ref discovery-group-name="my-discovery-group"/>
- <entries>
- <entry name="ConnectionFactory"/>
- </entries>
-</connection-factory>
+java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url = udp://231.7.7.7:9876
The element discovery-group-ref specifies the name of a
discovery group defined in activemq-configuration.xml.When this connection factory is downloaded from JNDI by a client application
@@ -471,27 +468,17 @@ ClientSession session2 = factory.createSession();
A static list of possible servers can also be used by a normal client.Configuring client discovery using JMS
- If you're using JMS and you're also using the JMS Service on the server to
- load your JMS connection factory instances into JNDI, then you can specify which
- connectors to use for your JMS connection factory in the server side xml
- configuration activemq-jms.xml. Let's take a look at an
- example:
+ If you're using JMS and you're using JNDI on the client to look up your JMS
+ connection factory instances then you can specify these parameters
+ in the JNDI context environment in, e.g. jndi.properties:
-<connection-factory name="ConnectionFactory">
- <connectors>
- <connector-ref connector-name="netty-connector"/>
- <connector-ref connector-name="netty-connector2"/>
- <connector-ref connector-name="netty-connector3"/>
- </connectors>
- <entries>
- <entry name="ConnectionFactory"/>
- </entries>
-</connection-factory>
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url=tcp://myhost:5445,myhost2:5445
- The element connectors contains a list of pre defined connectors in the
- activemq-configuration.xml file. When this connection factory is downloaded
- from JNDI by a client application and JMS connections are created from it, those connections will
- be load-balanced across the list of servers defined by these connectors.
+ The java.naming.provider.url contains a list of servers to use for the
+ connection factory. When this connection factory used client application and JMS connections
+ are created from it, those connections will be load-balanced across the list of servers defined
+ by the java.naming.provider.url.
If you're using JMS, but you're not using JNDI to lookup a connection factory - you're instantiating
@@ -830,20 +817,14 @@ ClientSession session = factory.createSession();
Specifying which load balancing policy to use differs whether you are using JMS or the
core API. If you don't specify a policy then the default will be used which is org.apache.activemq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy.
- If you're using JMS, and you're using JNDI on the server to put your JMS connection
- factories into JNDI, then you can specify the load balancing policy directly in the
- activemq-jms.xml configuration file on the server as follows:
+ If you're using JMS and you're using JNDI on the client to look up your JMS connection factory instances
+ then you can specify these parameters in the JNDI context environment in, e.g.
+ jndi.properties, to specify the load balancing policy directly:
-<connection-factory name="ConnectionFactory">
- <discovery-group-ref discovery-group-name="my-discovery-group"/>
- <entries>
- <entry name="ConnectionFactory"/>
- </entries>
- <connection-load-balancing-policy-class-name>
- org.apache.activemq.api.core.client.loadbalance.RandomConnectionLoadBalancingPolicy
- </connection-load-balancing-policy-class-name>
-</connection-factory>
- The above example would deploy a JMS connection factory that uses the random connection load
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url=tcp://localhost:5445
+connection.ConnectionFactory.loadBalancingPolicyClassName=org.apache.activemq.api.core.client.loadbalance.RandomConnectionLoadBalancingPolicy
+ The above example would instantiate a JMS connection factory that uses the random connection load
balancing policy. If you're using JMS but you're instantiating your connection factory directly on the
client side then you can set the load balancing policy using the setter on the
diff --git a/docs/user-manual/en/configuration-index.xml b/docs/user-manual/en/configuration-index.xml
index db63a1bc8e..8307d99eeb 100644
--- a/docs/user-manual/en/configuration-index.xml
+++ b/docs/user-manual/en/configuration-index.xml
@@ -73,364 +73,56 @@
-
- connection-factory
-
- ConnectionFactory
- a list of connection factories to create and add to JNDI
-
-
-
-
-
-
-
- Continued..
-
-
-
-
-
-
-
-
-
- connection-factory.signature (attribute)
-
- String
- Type of connection factory
- generic
-
-
-
- connection-factory.xa
-
- Boolean
- If it is a XA connection factory
- false
-
-
-
- connection-factory.auto-group
-
- Boolean
- whether or not message grouping is automatically used
- false
-
-
- connection-factory.connectors
-
- String
- A list of connectors used by the connection factory
-
-
-
- connection-factory.connectors.connector-ref.connector-name (attribute)
-
- String
- Name of the connector to connect to the live server
-
-
-
- connection-factory.discovery-group-ref.discovery-group-name (attribute)
-
- String
- Name of discovery group used by this connection factory
-
-
-
-
-
- connection-factory.discovery-initial-wait-timeout
-
- Long
- the initial time to wait (in ms) for discovery groups to wait for
- broadcasts
- 10000
-
-
-
- connection-factory.block-on-acknowledge
-
- Boolean
- whether or not messages are acknowledged synchronously
- false
-
-
-
- connection-factory.block-on-non-durable-send
-
- Boolean
- whether or not non-durable messages are sent synchronously
- false
-
-
-
- connection-factory.block-on-durable-send
-
- Boolean
- whether or not durable messages are sent synchronously
- true
-
-
- connection-factory.call-timeout
- Long
- the timeout (in ms) for remote calls
- 30000
-
-
-
- connection-factory.client-failure-check-period
-
- Long
- the period (in ms) after which the client will consider the
- connection failed after not receiving packets from the
- server
- 30000
-
-
-
- connection-factory.client-id
-
- String
- the pre-configured client ID for the connection factory
- null
-
-
-
-
- connection-factory.connection-load-balancing-policy-class-name
-
- String
- the name of the load balancing class
- org.apache.activemq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy
-
-
-
- connection-factory.connection-ttl
-
- Long
- the time to live (in ms) for connections
- 1 * 60000
-
-
-
- connection-factory.consumer-max-rate
- Integer
- the fastest rate a consumer may consume messages per
- second
- -1
-
-
-
- connection-factory.consumer-window-size
- Integer
- the window size (in bytes) for consumer flow control
- 1024 * 1024
-
-
-
- connection-factory.dups-ok-batch-size
- Integer
- the batch size (in bytes) between acknowledgements when using
- DUPS_OK_ACKNOWLEDGE mode
- 1024 * 1024
-
-
- connection-factory.failover-on-initial-connection
- Boolean
- whether or not to failover to backup on event that initial connection to live server fails
- false
-
-
-
- connection-factory.failover-on-server-shutdown
- Boolean
- whether or not to failover on server shutdown
- false
-
-
-
- connection-factory.min-large-message-size
- Integer
- the size (in bytes) before a message is treated as large
- 100 * 1024
-
-
-
- connection-factory.avoid-large-messages
- Boolean
- If compress large messages and send them as regular messages if possible
- false
-
-
- connection-factory.cache-large-message-client
- Boolean
- If true clients using this connection factory will hold the large
- message body on temporary files.
- false
-
-
-
- connection-factory.pre-acknowledge
- Boolean
- whether messages are pre acknowledged by the server before
- sending
- false
-
-
-
- connection-factory.producer-max-rate
- Integer
- the maximum rate of messages per second that can be sent
- -1
-
-
- connection-factory.producer-window-size
- Integer
- the window size in bytes for producers sending messages
- 1024 * 1024
-
-
-
- connection-factory.confirmation-window-size
-
- Integer
- the window size (in bytes) for reattachment confirmations
- 1024 * 1024
-
-
-
- connection-factory.reconnect-attempts
-
- Integer
- maximum number of retry attempts, -1 signifies infinite
- 0
-
-
-
- connection-factory.retry-interval
-
- Long
- the time (in ms) to retry a connection after failing
- 2000
-
-
-
- connection-factory.retry-interval-multiplier
-
- Double
- multiplier to apply to successive retry intervals
- 1.0
-
-
- connection-factory.max-retry-interval
- Integer
- The maximum retry interval in the case a retry-interval-multiplier has been specified
- 2000
-
-
-
- connection-factory.scheduled-thread-pool-max-size
-
- Integer
- the size of the scheduled thread pool
- 5
-
-
-
- connection-factory.thread-pool-max-size
-
- Integer
- the size of the thread pool
- -1
-
-
-
-
- connection-factory.transaction-batch-size
-
- Integer
- the batch size (in bytes) between acknowledgements when using a
- transactional session
- 1024 * 1024
-
-
-
- connection-factory.use-global-pools
-
- Boolean
- whether or not to use a global thread pool for threads
- true
-
-
- queue
+ queueQueuea queue to create and add to JNDI
- queue.name
- (attribute)
+ queue.name (attribute)Stringunique name of the queue
- queue.entry
+ queue.entryString
- context where the queue will be bound in JNDI (there can be
- many)
+ context where the queue will be bound in JNDI (there can be many)
- queue.durable
+ queue.durableBooleanis the queue durable?true
- queue.filter
+ queue.filterStringoptional filter expression for the queue
- topic
+ topicTopica topic to create and add to JNDI
- topic.name
- (attribute)
+ topic.name (attribute)Stringunique name of the topic
- topic.entry
+ topic.entryString
- context where the topic will be bound in JNDI (there can be
- many)
+ context where the topic will be bound in JNDI (there can be many)
-
+
diff --git a/docs/user-manual/en/configuring-transports.xml b/docs/user-manual/en/configuring-transports.xml
index 7ee6c00601..7e61d5069c 100644
--- a/docs/user-manual/en/configuring-transports.xml
+++ b/docs/user-manual/en/configuring-transports.xml
@@ -96,25 +96,16 @@
to other servers. That's defined by connectors.
- If you're using JMS and the server side JMS service to instantiate JMS
- ConnectionFactory instances and bind them in JNDI, then when creating the
- ActiveMQConnectionFactory it needs to know what server
- that connection factory will create connections to.
- That's defined by the connector-ref element in the activemq-jms.xml file on the server side. Let's take a look at a
- snipped from a activemq-jms.xml file that shows a JMS
- connection factory that references our netty connector defined in our activemq-configuration.xml file:
+ If you're using JMS and you're using JNDI on the client to look up your JMS connection factory
+ instances then when creating the ActiveMQConnectionFactory it needs to know what
+ server that connection factory will create connections to.
+ That's defined by the java.naming.provider.url element in the JNDI context
+ environment, e.g. jndi.properties. Behind the scenes, the
+ org.apache.activemq.jndi.ActiveMQInitialContextFactory uses the
+ java.naming.provider.url to construct the transport. Here's a simple example:
-<connection-factory name="ConnectionFactory">
- <connectors>
- <connector-ref connector-name="netty"/>
- </connectors>
- <entries>
- <entry name="ConnectionFactory"/>
- <entry name="XAConnectionFactory"/>
- </entries>
-</connection-factory>
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url=tcp://myhost:5445
@@ -168,7 +159,7 @@ Connection jmsConnection = connectionFactory.createConnection();
etc
-
+ Configuring the Netty transportOut of the box, ActiveMQ currently uses Netty, a high performance low level network library.
diff --git a/docs/user-manual/en/flow-control.xml b/docs/user-manual/en/flow-control.xml
index 5853f9ce4c..70ab4e2421 100644
--- a/docs/user-manual/en/flow-control.xml
+++ b/docs/user-manual/en/flow-control.xml
@@ -111,20 +111,14 @@
Using JMS
- if JNDI is used to look up the connection factory, the consumer window size is
- configured in activemq-jms.xml:
+ If JNDI is used on the client to instantiate and look up the connection factory the consumer window
+ size is configured in the JNDI context environment, e.g. jndi.properties. Here's a
+ simple example using the "ConnectionFactory" connection factory which is available in the context by
+ default:
-<connection-factory name="ConnectionFactory">
- <connectors>
- <connector-ref connector-name="netty-connector"/>
- </connectors>
- <entries>
- <entry name="ConnectionFactory"/>
- </entries>
-
- <!-- Set the consumer window size to 0 to have *no* buffer on the client side -->
- <consumer-window-size>0</consumer-window-size>
-</connection-factory>
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url=tcp://localhost:5445
+connection.ConnectionFactory.consumerWindowSize=0
If the connection factory is directly instantiated, the consumer window size is
specified by ActiveMQConnectionFactory.setConsumerWindowSize()
method.
@@ -153,20 +147,13 @@
Using JMS
- If JNDI is used to look up the connection factory, the max rate can be configured
- in activemq-jms.xml:
+ If JNDI is used to instantiate and look up the connection factory, the max rate can be configured in
+ the JNDI context environment, e.g. jndi.properties. Here's a simple example using the
+ "ConnectionFactory" connection factory which is available in the context by default:
-<connection-factory name="ConnectionFactory">
- <connectors>
- <connector-ref connector-name="netty-connector"/>
- </connectors>
- <entries>
- <entry name="ConnectionFactory"/>
- </entries>
- <!-- We limit consumers created on this connection factory to consume messages at a maximum rate
- of 10 messages per sec -->
- <consumer-max-rate>10</consumer-max-rate>
-</connection-factory>
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url=tcp://localhost:5445
+connection.ConnectionFactory.consumerMaxRate=10
If the connection factory is directly instantiated, the max rate size can be set
via the ActiveMQConnectionFactory.setConsumerMaxRate(int
consumerMaxRate) method.
@@ -208,18 +195,13 @@
Using JMS
- If JNDI is used to look up the connection factory, the producer window size can be
- configured in activemq-jms.xml:
+ If JNDI is used to instantiate and look up the connection factory, the producer window size can be
+ configured in the JNDI context environment, e.g. jndi.properties. Here's a simple
+ example using the "ConnectionFactory" connection factory which is available in the context by default:
-<connection-factory name="ConnectionFactory">
- <connectors>
- <connector-ref connector-name="netty-connector"/>
- </connectors>
- <entries>
- <entry name="ConnectionFactory"/>
- </entries>
- <producer-window-size>10</producer-window-size>
-</connection-factory>
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url=tcp://localhost:5445
+connection.ConnectionFactory.producerWindowSize=10
If the connection factory is directly instantiated, the producer window size can
be set via the ActiveMQConnectionFactory.setProducerWindowSize(int
producerWindowSize) method.
@@ -286,29 +268,22 @@
Using Core APIIf the ActiveMQ core API is being used the rate can be set via the ServerLocator.setProducerMaxRate(int consumerMaxRate) method or
+ >ServerLocator.setProducerMaxRate(int producerMaxRate) method or
alternatively via some of the ClientSession.createProducer()
methods. Using JMS
- If JNDI is used to look up the connection factory, the max rate can be configured
- in activemq-jms.xml:
+ If JNDI is used to instantiate and look up the connection factory, the max rate size can be
+ configured in the JNDI context environment, e.g. jndi.properties. Here's a simple
+ example using the "ConnectionFactory" connection factory which is available in the context by default:
-<connection-factory name="ConnectionFactory">
- <connectors>
- <connector-ref connector-name="netty-connector"/>
- </connectors>
- <entries>
- <entry name="ConnectionFactory"/>
- </entries>
- <!-- We limit producers created on this connection factory to produce messages at a maximum rate
- of 10 messages per sec -->
- <producer-max-rate>10</producer-max-rate>
-</connection-factory>
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url=tcp://localhost:5445
+connection.ConnectionFactory.producerMaxRate=10
If the connection factory is directly instantiated, the max rate size can be set
via the ActiveMQConnectionFactory.setProducerMaxRate(int
- consumerMaxRate) method.
+ producerMaxRate) method.
diff --git a/docs/user-manual/en/interoperability.xml b/docs/user-manual/en/interoperability.xml
index 3c9ceec37a..f3f3bdd9bf 100644
--- a/docs/user-manual/en/interoperability.xml
+++ b/docs/user-manual/en/interoperability.xml
@@ -229,9 +229,8 @@ hq-message-id : STOMP12345
Stomp requires the file jndi.properties to be available on the
classpath. This should look something like:
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.provider.url=jnp://localhost:1099
-java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+ Configure any required JNDI resources in this file according to the documentation.Make sure this file is in the classpath along with the StompConnect jar and the
ActiveMQ jars and simply run java org.codehaus.stomp.jms.Main.
diff --git a/docs/user-manual/en/large-messages.xml b/docs/user-manual/en/large-messages.xml
index 42b18d2670..43bc2a8e35 100644
--- a/docs/user-manual/en/large-messages.xml
+++ b/docs/user-manual/en/large-messages.xml
@@ -83,21 +83,14 @@ ClientSessionFactory factory = ActiveMQClient.createClientSessionFactory();
Using JMS
- If JNDI is used to look up the connection factory, the minimum large message size
- is specified in activemq-jms.xml
- ...
-<connection-factory name="ConnectionFactory">
- <connectors>
- <connector-ref connector-name="netty"/>
- </connectors>
- <entries>
- <entry name="ConnectionFactory"/>
- <entry name="XAConnectionFactory"/>
- </entries>
-
- <min-large-message-size>250000</min-large-message-size>
-</connection-factory>
-...
+ If JNDI is used to instantiate and look up the connection factory, the minimum large message size
+ is configured in the JNDI context environment, e.g. jndi.properties. Here's a simple
+ example using the "ConnectionFactory" connection factory which is available in the context by default:
+
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url=tcp://localhost:5445
+connection.ConnectionFactory.minLargeMessageSize=250000
+ If the connection factory is being instantiated directly, the minimum large
message size is specified by ActiveMQConnectionFactory.setMinLargeMessageSize.
@@ -121,17 +114,13 @@ ClientSessionFactory factory = ActiveMQClient.createClientSessionFactory();
- If you use JMS, you can achieve large messages compression by configuring your
- connection factories. For example,
- ...
-<connection-factory name="ConnectionFactory">
- <connectors>
- <connector-ref connector-name="netty"/>
- </connectors>
-...
- <compress-large-messages>true</compress-large-messages>
-</connection-factory>
-...
+ If JNDI is used to instantiate and look up the connection factory, large message compression can be
+ configured in the JNDI context environment, e.g. jndi.properties. Here's a simple
+ example using the "ConnectionFactory" connection factory which is available in the context by default:
+
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url=tcp://localhost:5445
+connection.ConnectionFactory.compressLargeMessages=true
diff --git a/docs/user-manual/en/logging.xml b/docs/user-manual/en/logging.xml
index 27b4bfa515..8277b5562d 100644
--- a/docs/user-manual/en/logging.xml
+++ b/docs/user-manual/en/logging.xml
@@ -69,21 +69,9 @@
Logging in a client or with an Embedded server
- Firstly, if you want to enable logging on the client side you need to include the jboss logging jars in your library.
- If you are using the distribution make sure the jnp-client.jar is included or if you are using maven add the following
- dependencies.
+ Firstly, if you want to enable logging on the client side you need to include the JBoss logging jars in your library.
+ If you are using maven add the following dependencies.
-<dependency>
-<groupId>org.jboss.naming</groupId>
-<artifactId>jnp-client</artifactId>
-<version>5.0.5.Final</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- </exclusion>
- </exclusions>
-</dependency>
<dependency>
<groupId>org.jboss.logmanager</groupId>
<artifactId>jboss-logmanager</artifactId>
@@ -94,8 +82,6 @@
<artifactId>activemq-core-client</artifactId>
<version>2.3.0.Final</version>
</dependency>
- The first dependency jnp-client is not actually needed for logging, however this is needed for
- using JNDI and imports a previous version JBoss logging which needs to be excluded
There are 2 properties you need to set when starting your java program, the first is to set the Log Manager to use
diff --git a/docs/user-manual/en/message-grouping.xml b/docs/user-manual/en/message-grouping.xml
index b371897391..6ed962b272 100644
--- a/docs/user-manual/en/message-grouping.xml
+++ b/docs/user-manual/en/message-grouping.xml
@@ -77,34 +77,23 @@
message = ...
message.setStringProperty("JMSXGroupID", "Group-0");
producer.send(message);
- Alternatively, you can set autogroup to true on the ActiveMQConnectonFactory which will pick a random unique id. This can also be
- set in the activemq-jms.xml file like this:
+ Alternatively, you can set autogroup to true on the
+ ActiveMQConnectonFactory which will pick a random unique id. This can also be set in the
+ JNDI context environment, e.g. jndi.properties. Here's a simple example using the
+ "ConnectionFactory" connection factory which is available in the context by default
-<connection-factory name="ConnectionFactory">
- <connectors>
- <connector-ref connector-name="netty-connector"/>
- </connectors>
- <entries>
- <entry name="ConnectionFactory"/>
- </entries>
- <autogroup>true</autogroup>
-</connection-factory>
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url=tcp://localhost:5445
+connection.ConnectionFactory.autoGroup=true
Alternatively you can set the group id via the connection factory. All messages sent
with producers created via this connection factory will set the JMSXGroupID to the specified value on all messages sent. To configure the
- group id set it on the connection factory in the activemq-jms.xml config
- file as follows
+ >JMSXGroupID to the specified value on all messages sent. This can also be set in the
+ JNDI context environment, e.g. jndi.properties. Here's a simple example using the
+ "ConnectionFactory" connection factory which is available in the context by default:
-<connection-factory name="ConnectionFactory">
- <connectors>
- <connector-ref connector-name="netty-connector"/>
- </connectors>
- <entries>
- <entry name="ConnectionFactory"/>
- </entries>
- <group-id>Group-0</group-id>
-</connection-factory>
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url=tcp://localhost:5445
+connection.ConnectionFactory.groupID=Group-0
Example
diff --git a/docs/user-manual/en/pre-acknowledge.xml b/docs/user-manual/en/pre-acknowledge.xml
index 77e21288c9..d8eec48442 100644
--- a/docs/user-manual/en/pre-acknowledge.xml
+++ b/docs/user-manual/en/pre-acknowledge.xml
@@ -57,18 +57,12 @@
Using PRE_ACKNOWLEDGE
- This can be configured in the activemq-jms.xml file on the connection factory like this:
+ This can be configured in a client's JNDI context environment, e.g. jndi.properties,
+ like this:
-<connection-factory name="ConnectionFactory">
- <connectors>
- <connector-ref connector-name="netty-connector"/>
- </connectors>
- <entries>
- <entry name="ConnectionFactory"/>
- </entries>
- <pre-acknowledge>true</pre-acknowledge>
-</connection-factory>
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url=tcp://localhost:5445
+connection.ConnectionFactory.preAcknowledge=true
Alternatively, to use pre-acknowledgement mode using the JMS API, create a JMS Session
with the ActiveMQSession.PRE_ACKNOWLEDGE constant.
diff --git a/docs/user-manual/en/spring-integration.xml b/docs/user-manual/en/spring-integration.xml
index a929a67bc2..b5168715d8 100644
--- a/docs/user-manual/en/spring-integration.xml
+++ b/docs/user-manual/en/spring-integration.xml
@@ -40,20 +40,9 @@
<configuration xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd">
- <!--the connection factory used by the example-->
- <connection-factory name="ConnectionFactory">
- <connectors>
- <connector-ref connector-name="in-vm"/>
- </connectors>
- <entries>
- <entry name="ConnectionFactory"/>
- </entries>
- </connection-factory>
<!--the queue used by the example-->
- <queue name="exampleQueue">
- <entry name="/queue/exampleQueue"/>
- </queue>
+ <queue name="exampleQueue"/>
</configuration>Here we've specified a
javax.jms.ConnectionFactory we want bound to a
diff --git a/docs/user-manual/en/thread-pooling.xml b/docs/user-manual/en/thread-pooling.xml
index 074fa22ecc..85a3189605 100644
--- a/docs/user-manual/en/thread-pooling.xml
+++ b/docs/user-manual/en/thread-pooling.xml
@@ -137,20 +137,14 @@ myFactory.setThreadPoolMaxSize(-1);
ConnectionFactory myConnectionFactory = ActiveMQJMSClient.createConnectionFactory(myFactory);If you're using JNDI to instantiate ActiveMQConnectionFactory
- instances, you can also set these parameters in the activemq-jms.xml
- file where you describe your connection factory, for example:
+ instances, you can also set these parameters in the JNDI context environment, e.g.
+ jndi.properties. Here's a simple example using the "ConnectionFactory" connection
+ factory which is available in the context by default:
-<connection-factory name="ConnectionFactory">
- <connectors>
- <connector-ref connector-name="netty"/>
- </connectors>
- <entries>
- <entry name="ConnectionFactory"/>
- <entry name="XAConnectionFactory"/>
- </entries>
- <use-global-pools>false</use-global-pools>
- <scheduled-thread-pool-max-size>10</scheduled-thread-pool-max-size>
- <thread-pool-max-size>-1</thread-pool-max-size>
-</connection-factory>
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url=tcp://localhost:5445
+connection.ConnectionFactory.useGlobalPools=false
+connection.ConnectionFactory.scheduledThreadPoolMaxSize=10
+connection.ConnectionFactory.threadPoolMaxSize=-1
diff --git a/docs/user-manual/en/using-jms.xml b/docs/user-manual/en/using-jms.xml
index 40be7b7afa..fdf0729dec 100644
--- a/docs/user-manual/en/using-jms.xml
+++ b/docs/user-manual/en/using-jms.xml
@@ -49,210 +49,262 @@
server JMS configuration so it is created automatically without us having to explicitly
create it from the client.
-
- JMS Server Configuration
- The file activemq-jms.xml on the server classpath contains any JMS
- Queue, Topic and ConnectionFactory instances that we wish to create and make available
- to lookup via the JNDI.
- A JMS ConnectionFactory object is used by the client to make connections to the
- server. It knows the location of the server it is connecting to, as well as many other
- configuration parameters. In most cases the defaults will be acceptable.
- We'll deploy a single JMS Queue and a single JMS Connection Factory instance on the
- server for this example but there are no limits to the number of Queues, Topics and
- Connection Factory instances you can deploy from the file. Here's our
- configuration:
-
-<configuration xmlns="urn:activemq"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:activemq ../schemas/activemq-jms.xsd ">
-
- <connection-factory name="ConnectionFactory">
- <connectors>
- <connector-ref connector-name="netty"/>
- </connectors>
- <entries>
- <entry name="ConnectionFactory"/>
- </entries>
- </connection-factory>
-
- <queue name="OrderQueue">
- <entry name="queues/OrderQueue"/>
- </queue>
-</configuration>
- We deploy one ConnectionFactory called ConnectionFactory and bind
- it in just one place in JNDI as given by the entry element.
- ConnectionFactory instances can be bound in many places in JNDI if you require.
+
+ JNDI Configuration
+ The JMS specification establishes the convention that administered
+ objects (i.e. JMS queue, topic and connection factory instances) are made
+ available via the JNDI API. Brokers are free to implement JNDI as they see fit assuming
+ the implementation fits the API. ActiveMQ does not have a JNDI server. Rather, it uses a
+ client-side JNDI implementation that relies on special properties set in the environment
+ to construct the appropriate JMS objects. In other words, no objects are stored in JNDI
+ on the ActiveMQ server. There are simply instantiated on the client based on the provided
+ configuration. Let's look at the different kinds of administered objects and how to configure
+ them.
- The JMS connection factory references a connector called
- netty. This is a reference to a connector object deployed in
- the main core configuration file activemq-configuration.xml which
- defines the transport and parameters used to actually connect to the server.
+ The following configuration properties are strictly required when ActiveMQ
+ is running in stand-alone mode. When ActiveMQ is integrated to an application
+ server (e.g. Wildfly) the application server itself will almost certainly provide a JNDI
+ client with its own properties.
-
-
- Connection Factory Types
- The JMS API doc provides several connection factories for applications. ActiveMQ JMS users
- can choose to configure the types for their connection factories. Each connection factory
- has a signature attribute and a xa parameter, the
- combination of which determines the type of the factory. Attribute signature
- has three possible string values, i.e. generic,
- queue and topic; xa is a boolean
- type parameter. The following table gives their configuration values for different
- connection factory interfaces.
-
+
+ ConnectionFactory JNDI
+ A JMS connection factory is used by the client to make connections to the server.
+ It knows the location of the server it is connecting to, as well as many other
+ configuration parameters.
+ By default, a javax.naming.Context instance created using the
+ org.apache.activemq.jndi.ActiveMQInitialContextFactory will automatically
+ have the following connection factories available for lookup:
+
+
+ ConnectionFactory
+
+
+ XAConnectionFactory
+
+
+ QueueConnectionFactory
+
+
+ TopicConnectionFactory
+
+
+ Here's a simple example of the JNDI context environment for a client looking up a connection factory
+ to access an embedded instance of ActiveMQ:
+
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+ It's really as simple as that. As noted previously, any JNDI context created with the
+ ActiveMQInitialContextFactory will have a set of default connection factories
+ available. Therefore, only the java.naming.factory.initial property is required
+ to access an embedded broker.
+ In certain situations there could be multiple server instances running within a particular JVM. In
+ that situation each server would typically have an InVM acceptor with a unique server-ID. A client
+ using JMS and JNDI can account for this by specifying a
+ javax.naming.Context.PROVIDER_URL (String value of
+ "java.naming.provider.url") in the JNDI environment like vm://2 where
+ 2 is the server-ID for acceptor.
+ Here is a list of all the supported URL schemes:
+
+ vm
+ tcp
+ udp
+ jgroups
+
+ Most clients won't be connecting to an embedded broker. Clients will most commonly connect
+ across a network a remote broker. In that case the client can use the
+ javax.naming.Context.PROVIDER_URL (String value of
+ "java.naming.provider.url") in the JNDI environment to specify where to connect. Here's a simple
+ example of a client configuring a connection factory to connect to a remote broker running on
+ myhost:5445:
+
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url=tcp://myhost:5445
+ In the example above the client is using the tcp scheme for the provider URL.
+ A client may also specify multiple comma-delimited host:port combinations in the URL (e.g.
+ tcp://remote-host1:5445,remote-host2:5445). Whether there is one or many
+ host:port combinations in the URL they are treated as the initial connector(s)
+ for the underlying connection.
+ The udp scheme is also supported which should use an host:port combination that
+ matches the group-address and group-port from the corresponding
+ broadcast-group configured on the ActiveMQ server(s).
+ Each scheme has a specific set of properties which can be set using the traditional URL query string
+ format (e.g. scheme://host:port?key1=value1&key2=value2) to customize the underlying
+ transport mechanism. For example, if a client wanted to connect to a remote server using TCP and SSL
+ it would use a Context.PROVIDER_URL of
+ tcp://remote-host:5445?ssl-enabled=true.
+ All the properties available for the tcp scheme are described in
+ the documentation regarding the Netty transport.
+ The udp scheme supports 4 properties:
+
+
+ local-address - If you are running with multiple network interfaces on the same
+ machine, you may want to specify that the discovery group listens only only a specific interface. To
+ do this you can specify the interface address with this parameter.
+
+
+ local-port - If you want to specify a local port to which the datagram socket is
+ bound you can specify it here. Normally you would just use the default value of -1 which signifies
+ that an anonymous port should be used. This parameter is always specified in conjunction with
+ local-address.
+
+
+ refresh-timeout - This is the period the discovery group waits after receiving
+ the last broadcast from a particular server before removing that servers connector pair entry from its
+ list. You would normally set this to a value significantly higher than the broadcast-period on the
+ broadcast group otherwise servers might intermittently disappear from the list even though they are
+ still broadcasting due to slight differences in timing. This parameter is optional, the default value
+ is 10000 milliseconds (10 seconds).
+
+
+ discovery-initial-wait-timeout - If the connection factory is used immediately
+ after creation then it may not have had enough time to received broadcasts from all the nodes in the
+ cluster. On first usage, the connection factory will make sure it waits this long since creation
+ before creating the first connection. The default value for this parameter is 10000 milliseconds.
+
+
+ Lastly, the jgroups scheme is supported which provides an alternative to the
+ udp scheme for server discovery. The URL pattern is as follows
+ jgroups://<jgroups-xml-conf-filename> where
+ <jgroups-xml-conf-filename> refers to an XML file on the classpath that contains
+ the JGroups configuration.
+ The refresh-timeout and discovery-initial-wait-timeout properties
+ are supported just like with udp.
+ Although a javax.naming.Context instance created using the
+ org.apache.activemq.jndi.ActiveMQInitialContextFactory will automatically
+ have some connection factories present, it is possible for a client to specify its own connection
+ factories. This is done using the
+ org.apache.activemq.jndi.ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES
+ property (String value of "connectionFactoryNames"). The value for this property is a comma delimited
+ String of all the connection factories the client wishes to create. For example:
+
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url=tcp://localhost:5445
+connectionFactoryNames=myConnectionFactory
+ In this example, the client is creating a connection factory named "myConnectionFactory." This
+ replaces all the default connection factories so that only the "myConnectionFactory" connection factory
+ is available to the client.
+ Aside from the underlying transport, the underlying connection factory implementation can also be
+ configured using special properties. To configure a particular connection factory the client would
+ follow this pattern for the property name to set in the environment:
+ connection.<connection-factory-name>.<property-name>. For example, if the
+ client wanted to customize the default connection factory "ConnectionFactory" to support
+ high-availability then it would do this:
+
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url=tcp://myhost:5445
+connection.ConnectionFactory.ha=true
+ Any property available on the underlying
+ org.apache.activemq.jms.client.ActiveMQConnectionFactory can be set this way in
+ addition to the ha (boolean) and type (String) properties. Here
+ are the different options for the type:
+