Merge #34 on JNDI changes
This commit is contained in:
commit
46182e4155
|
@ -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
|
||||
|
||||
|
|
|
@ -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<ActiveMQComponent> 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);
|
||||
|
|
|
@ -40,9 +40,6 @@ public class BrokerDTO
|
|||
@XmlElementRef
|
||||
public SecurityDTO security;
|
||||
|
||||
@XmlElementRef
|
||||
public NamingDTO naming;
|
||||
|
||||
@XmlElementRef(required = false)
|
||||
public WebServerDTO web;
|
||||
|
||||
|
|
|
@ -19,5 +19,4 @@ CoreDTO
|
|||
JmsDTO
|
||||
SecurityDTO
|
||||
BasicSecurityDTO
|
||||
NamingDTO
|
||||
|
||||
|
|
|
@ -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
|
||||
* <i>destinations</i> 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<String, Object> data = new ConcurrentHashMap<String, Object>();
|
||||
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<String, Object> 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<String> list = new ArrayList<String>();
|
||||
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<String, Object> 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<String, Object> 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<String, String> parseQuery(String uri) throws URISyntaxException
|
||||
{
|
||||
try
|
||||
{
|
||||
uri = uri.substring(uri.lastIndexOf("?") + 1); // get only the relevant part of the query
|
||||
Map<String, String> rc = new HashMap<String, String>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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 <p/> 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.
|
||||
* </p>
|
||||
* <p>
|
||||
* 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:
|
||||
* </p>
|
||||
* <code>
|
||||
* Context componentContext = (Context)new InitialContext().lookup("java:comp");
|
||||
* String envEntry = (String) componentContext.lookup("env/myEntry");
|
||||
* String envEntry2 = (String) componentContext.lookup("env/myEntry2");
|
||||
* </code>
|
||||
*/
|
||||
@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<String, Object> environment; // environment for this context
|
||||
protected final Map<String, Object> bindings; // bindings at my level
|
||||
protected final Map<String, Object> treeBindings; // all bindings under me
|
||||
|
||||
private boolean frozen;
|
||||
private String nameInNamespace = "";
|
||||
|
||||
public ReadOnlyContext()
|
||||
{
|
||||
environment = new Hashtable<String, Object>();
|
||||
bindings = new HashMap<String, Object>();
|
||||
treeBindings = new HashMap<String, Object>();
|
||||
}
|
||||
|
||||
public ReadOnlyContext(Hashtable env)
|
||||
{
|
||||
if (env == null)
|
||||
{
|
||||
this.environment = new Hashtable<String, Object>();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.environment = new Hashtable<String, Object>(env);
|
||||
}
|
||||
this.bindings = Collections.EMPTY_MAP;
|
||||
this.treeBindings = Collections.EMPTY_MAP;
|
||||
}
|
||||
|
||||
public ReadOnlyContext(Hashtable environment, Map<String, Object> bindings)
|
||||
{
|
||||
if (environment == null)
|
||||
{
|
||||
this.environment = new Hashtable<String, Object>();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.environment = new Hashtable<String, Object>(environment);
|
||||
}
|
||||
this.bindings = new HashMap<String, Object>();
|
||||
treeBindings = new HashMap<String, Object>();
|
||||
if (bindings != null)
|
||||
{
|
||||
for (Map.Entry<String, Object> 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<String, Object>(env);
|
||||
}
|
||||
|
||||
protected ReadOnlyContext(ReadOnlyContext clone, Hashtable<String, Object> 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<String, Object> internalBind(String name, Object value) throws NamingException
|
||||
{
|
||||
assert name != null && name.length() > 0;
|
||||
assert !frozen;
|
||||
|
||||
Map<String, Object> newBindings = new HashMap<String, Object>();
|
||||
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<String, Object> 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<String, Object> getEnvironment() throws NamingException
|
||||
{
|
||||
return (Hashtable<String, Object>) 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());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -53,10 +53,6 @@
|
|||
<groupId>org.jboss</groupId>
|
||||
<artifactId>jboss-transaction-spi</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.naming</groupId>
|
||||
<artifactId>jnpserver</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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<String> jndiNames = new ArrayList<String>();
|
||||
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<String> jndiNames = new ArrayList<String>();
|
||||
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<String> jndiBindings = new ArrayList<String>();
|
||||
List<String> connectorNames = new ArrayList<String>();
|
||||
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<String> connectors = new ArrayList<String>(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<JMSQueueConfiguration> queues,
|
||||
final ArrayList<TopicConfiguration> topics,
|
||||
final ArrayList<ConnectionFactoryConfiguration> cfs, String domain)
|
||||
final ArrayList<TopicConfiguration> topics, String domain)
|
||||
{
|
||||
return new JMSConfigurationImpl()
|
||||
.setConnectionFactoryConfigurations(cfs)
|
||||
.setQueueConfigurations(queues)
|
||||
.setTopicConfigurations(topics)
|
||||
.setDomain(domain);
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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<JMSQueueConfiguration> 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<TopicConfiguration> topicConfigs = config.getTopicConfigurations();
|
||||
for (TopicConfiguration tConfig : topicConfigs)
|
||||
{
|
||||
String[] bindings = tConfig.getBindings();
|
||||
createTopic(false, tConfig.getName(), bindings);
|
||||
createTopic(false, tConfig.getName(), tConfig.getBindings());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
|
||||
* 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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,259 +9,37 @@
|
|||
version="1.0">
|
||||
|
||||
<xsd:element name="configuration" amq:schema="activemq-jms-configuration">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="jmx-domain" type="xsd:string" default="org.apache.activemq"
|
||||
minOccurs="0" maxOccurs="1"/>
|
||||
<xsd:element ref="connection-factory" maxOccurs="unbounded" minOccurs="0"/>
|
||||
<xsd:choice maxOccurs="unbounded" minOccurs="0">
|
||||
<xsd:element ref="queue" maxOccurs="1" minOccurs="1"/>
|
||||
<xsd:element ref="topic" maxOccurs="1" minOccurs="1"/>
|
||||
<xsd:choice maxOccurs="unbounded" minOccurs="0">
|
||||
<xsd:element ref="queue" maxOccurs="1" minOccurs="1"/>
|
||||
<xsd:element ref="topic" maxOccurs="1" minOccurs="1"/>
|
||||
</xsd:choice>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="connection-factory">
|
||||
<xsd:annotation amq:linkend="using-jms.server.configuration">
|
||||
<xsd:documentation>a list of connection factories to create and add to
|
||||
JNDI</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:all>
|
||||
<xsd:element name="xa" type="xsd:boolean" default="false" maxOccurs="1" minOccurs="0">
|
||||
<xsd:annotation amq:linkend="using-jms.configure.factory.types"
|
||||
amq:id="configuration.connection-factory.signature.xa">
|
||||
<xsd:documentation>Whether this is an XA connection factory</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="discovery-group-ref" type="discovery-group-refType" maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="queue" type="queueType"></xsd:element>
|
||||
|
||||
<xsd:element name="connectors" maxOccurs="1" minOccurs="0">
|
||||
<xsd:annotation amq:linkend="clusters">
|
||||
<xsd:documentation>A sequence of connectors used by the connection factory
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="connector-ref" maxOccurs="unbounded" minOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>A connector reference
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="connector-name" type="xsd:string" use="required">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Name of the connector to connect to the live server
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="entries" maxOccurs="1" minOccurs="0">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="entry" type="entryType" maxOccurs="unbounded" minOccurs="1">
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="client-failure-check-period" type="xsd:long" default="30000"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
<xsd:annotation amq:id="configuration.connection-factory.client-failure-check-period"
|
||||
amq:linkend="dead.connections" amq:default="(ms)">
|
||||
<xsd:documentation>
|
||||
the period (in ms) after which the client will consider the connection failed
|
||||
after not receiving packets from the server. -1 disables this setting.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="connection-ttl" type="xsd:long" maxOccurs="1" minOccurs="0">
|
||||
<xsd:annotation amq:id="configuration.connection-factory.connection-ttl"
|
||||
amq:linkend="dead.connections">
|
||||
<xsd:documentation>the time to live (in ms) for connections
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="call-timeout" type="xsd:long" default="30000"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
<xsd:annotation amq:id="configuration.connection-factory.call-timeout">
|
||||
<xsd:documentation>
|
||||
the timeout (in ms) for remote calls
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="call-failover-timeout" type="xsd:long"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="consumer-window-size" type="xsd:int"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="consumer-max-rate" type="xsd:int"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="confirmation-window-size" type="xsd:int"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="producer-window-size" type="xsd:int"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="producer-max-rate" type="xsd:int"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="cache-large-message-client" type="xsd:boolean"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="min-large-message-size" type="xsd:long"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="compress-large-messages" type="xsd:boolean"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="client-id" type="xsd:string" maxOccurs="1" minOccurs="0">
|
||||
<xsd:annotation amq:id="configuration.connection-factory.client-id"
|
||||
amq:linkend="using-jms.clientid">
|
||||
<xsd:documentation>
|
||||
the pre-configured client ID for the connection factory
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="dups-ok-batch-size" type="xsd:int"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="transaction-batch-size" type="xsd:int"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="block-on-acknowledge" type="xsd:boolean" default="false"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
<xsd:annotation amq:linkend="send-guarantees.nontrans.acks"
|
||||
amq:id="configuration.connection-factory.block-on-acknowledge">
|
||||
<xsd:documentation>
|
||||
whether or not messages are acknowledged synchronously
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="block-on-non-durable-send" type="xsd:boolean" default="false"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
<xsd:annotation amq:id="configuration.connection-factory.block-on-non-durable-send"
|
||||
amq:linkend="non-transactional-sends">
|
||||
<xsd:documentation>
|
||||
whether or not non-durable messages are sent synchronously
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="block-on-durable-send" type="xsd:boolean" default="true"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
<xsd:annotation amq:id="configuration.connection-factory.block-on-durable-send"
|
||||
amq:linkend="non-transactional-sends">
|
||||
<xsd:documentation>
|
||||
whether or not durable messages are sent synchronously
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="auto-group" type="xsd:boolean" default="false" maxOccurs="1" minOccurs="0">
|
||||
<xsd:annotation amq:id="configuration.connection-factory.auto-group"
|
||||
amq:linkend="message-grouping.jmsconfigure">
|
||||
<xsd:documentation>whether or not message grouping is automatically used
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="pre-acknowledge" type="xsd:boolean"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="retry-interval" type="xsd:long"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="retry-interval-multiplier" type="xsd:float"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="max-retry-interval" type="xsd:long"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="reconnect-attempts" type="xsd:int"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="failover-on-initial-connection" type="xsd:boolean"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="failover-on-server-shutdown" type="xsd:boolean"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="connection-load-balancing-policy-class-name" type="xsd:string"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="use-global-pools" type="xsd:boolean"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="scheduled-thread-pool-max-size" type="xsd:int"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="thread-pool-max-size" type="xsd:int"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="group-id" type="xsd:string"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
<xsd:element name="ha" type="xsd:boolean"
|
||||
maxOccurs="1" minOccurs="0">
|
||||
</xsd:element>
|
||||
</xsd:all>
|
||||
<xsd:attribute name="name" type="xsd:string"></xsd:attribute>
|
||||
<xsd:attribute name="signature" type="xsd:string">
|
||||
<xsd:annotation amq:id="configuration.connection-factory.signature"
|
||||
amq:linkend="using-jms.configure.factory.types"
|
||||
amq:default="generic"> <!-- XXX -->
|
||||
<xsd:documentation>Type of connection factory</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:complexType name="entryType">
|
||||
<xsd:attribute name="name" type="xsd:string" use="required"></xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="discovery-group-refType">
|
||||
<xsd:attribute name="discovery-group-name" type="xsd:string" use="required">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Name of discovery group used by this connection factory
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:element name="queue" type="queueType"></xsd:element>
|
||||
|
||||
<xsd:element name="topic" type="topicType"></xsd:element>
|
||||
<xsd:element name="topic" type="topicType"></xsd:element>
|
||||
|
||||
<xsd:complexType name="queueType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="entry" type="entryType" maxOccurs="unbounded" minOccurs="1"></xsd:element>
|
||||
<xsd:element name="selector" maxOccurs="1" minOccurs="0">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="string" type="xsd:string" use="required"></xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="durable" type="xsd:boolean" maxOccurs="1" minOccurs="0"></xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required"></xsd:attribute>
|
||||
</xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="selector" maxOccurs="1" minOccurs="0">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="string" type="xsd:string" use="required"></xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="durable" type="xsd:boolean" maxOccurs="1" minOccurs="0"></xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required"></xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="topicType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="entry" type="entryType" maxOccurs="unbounded" minOccurs="1"></xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required"></xsd:attribute>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="topicType">
|
||||
<xsd:sequence>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required"></xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:schema>
|
||||
|
|
|
@ -46,6 +46,13 @@
|
|||
<artifactId>activemq-jms-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<!-- exclude JCA 1.5 spec here so geronimo dependency will be used -->
|
||||
<groupId>org.jboss.spec.javax.resource</groupId>
|
||||
<artifactId>jboss-connector-api_1.5_spec</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
|
|
|
@ -37,4 +37,8 @@ public class EmbeddedRestActiveMQJMS extends EmbeddedRestActiveMQ
|
|||
return ((EmbeddedJMS) embeddedActiveMQ).getRegistry();
|
||||
}
|
||||
|
||||
public EmbeddedJMS getEmbeddedJMS()
|
||||
{
|
||||
return (EmbeddedJMS) embeddedActiveMQ;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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<String> 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());
|
||||
|
|
|
@ -1,19 +1,8 @@
|
|||
<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>
|
||||
|
|
|
@ -101,11 +101,6 @@
|
|||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>activemq-aerogear-integration</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>jnp-client</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
<include>org.apache.activemq.rest:activemq-rest</include>
|
||||
<!-- dependencies -->
|
||||
<include>org.jboss.spec.javax.jms:jboss-jms-api_2.0_spec</include>
|
||||
<include>org.jboss.naming:jnpserver</include>
|
||||
<include>org.jboss.logmanager:jboss-logmanager</include>
|
||||
<include>org.jboss:jboss-common-core</include>
|
||||
<include>io.netty:netty-all</include>
|
||||
|
|
|
@ -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 $@
|
|
@ -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%
|
||||
|
|
|
@ -2,52 +2,8 @@
|
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd">
|
||||
|
||||
<connection-factory name="NettyXAConnectionFactory">
|
||||
<xa>true</xa>
|
||||
<connectors>
|
||||
<connector-ref connector-name="netty"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="/XAConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory>
|
||||
<queue name="DLQ"/>
|
||||
|
||||
<connection-factory name="NettyConnectionFactory">
|
||||
<xa>false</xa>
|
||||
<connectors>
|
||||
<connector-ref connector-name="netty"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="/ConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory>
|
||||
|
||||
<connection-factory name="NettyThroughputConnectionFactory">
|
||||
<xa>true</xa>
|
||||
<connectors>
|
||||
<connector-ref connector-name="netty-throughput"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="/XAThroughputConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory>
|
||||
|
||||
<connection-factory name="NettyThroughputConnectionFactory">
|
||||
<xa>false</xa>
|
||||
<connectors>
|
||||
<connector-ref connector-name="netty-throughput"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="/ThroughputConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory>
|
||||
|
||||
<queue name="DLQ">
|
||||
<entry name="/queue/DLQ"/>
|
||||
</queue>
|
||||
|
||||
<queue name="ExpiryQueue">
|
||||
<entry name="/queue/ExpiryQueue"/>
|
||||
</queue>
|
||||
<queue name="ExpiryQueue"/>
|
||||
|
||||
</configuration>
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
|
||||
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
|
|
@ -2,52 +2,8 @@
|
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd">
|
||||
|
||||
<connection-factory name="NettyXAConnectionFactory">
|
||||
<xa>true</xa>
|
||||
<connectors>
|
||||
<connector-ref connector-name="netty"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="/XAConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory>
|
||||
<queue name="DLQ"/>
|
||||
|
||||
<connection-factory name="NettyConnectionFactory">
|
||||
<xa>false</xa>
|
||||
<connectors>
|
||||
<connector-ref connector-name="netty"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="/ConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory>
|
||||
|
||||
<connection-factory name="NettyThroughputConnectionFactory">
|
||||
<xa>true</xa>
|
||||
<connectors>
|
||||
<connector-ref connector-name="netty-throughput"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="/XAThroughputConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory>
|
||||
|
||||
<connection-factory name="NettyThroughputConnectionFactory">
|
||||
<xa>false</xa>
|
||||
<connectors>
|
||||
<connector-ref connector-name="netty-throughput"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="/ThroughputConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory>
|
||||
|
||||
<queue name="DLQ">
|
||||
<entry name="/queue/DLQ"/>
|
||||
</queue>
|
||||
|
||||
<queue name="ExpiryQueue">
|
||||
<entry name="/queue/ExpiryQueue"/>
|
||||
</queue>
|
||||
<queue name="ExpiryQueue"/>
|
||||
|
||||
</configuration>
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
|
||||
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
|
|
@ -3,7 +3,7 @@
|
|||
xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
|
||||
<!--
|
||||
if you want to run this as a backup on different ports you would need to set the following variable
|
||||
export CLUSTER_PROPS="-Djnp.port=1199 -Djnp.rmiPort=1198 -Djnp.host=localhost -Dactivemq.remoting.netty.host=localhost -Dactivemq.remoting.netty.port=5545 -Dactivemq.remoting.netty.batch.port=5555 -Dactivemq.backup=true"
|
||||
export CLUSTER_PROPS="-Dactivemq.remoting.netty.host=localhost -Dactivemq.remoting.netty.port=5545 -Dactivemq.remoting.netty.batch.port=5555 -Dactivemq.backup=true"
|
||||
-->
|
||||
|
||||
<paging-directory>${data.dir:../data}/paging</paging-directory>
|
||||
|
|
|
@ -2,52 +2,8 @@
|
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd">
|
||||
|
||||
<connection-factory name="NettyXAConnectionFactory">
|
||||
<xa>true</xa>
|
||||
<connectors>
|
||||
<connector-ref connector-name="netty"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="/XAConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory>
|
||||
<queue name="DLQ"/>
|
||||
|
||||
<connection-factory name="NettyConnectionFactory">
|
||||
<xa>false</xa>
|
||||
<connectors>
|
||||
<connector-ref connector-name="netty"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="/ConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory>
|
||||
|
||||
<connection-factory name="NettyThroughputConnectionFactory">
|
||||
<xa>true</xa>
|
||||
<connectors>
|
||||
<connector-ref connector-name="netty-throughput"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="/XAThroughputConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory>
|
||||
|
||||
<connection-factory name="NettyThroughputConnectionFactory">
|
||||
<xa>false</xa>
|
||||
<connectors>
|
||||
<connector-ref connector-name="netty-throughput"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="/ThroughputConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory>
|
||||
|
||||
<queue name="DLQ">
|
||||
<entry name="/queue/DLQ"/>
|
||||
</queue>
|
||||
|
||||
<queue name="ExpiryQueue">
|
||||
<entry name="/queue/ExpiryQueue"/>
|
||||
</queue>
|
||||
<queue name="ExpiryQueue"/>
|
||||
|
||||
</configuration>
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
|
||||
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
|
|
@ -3,7 +3,7 @@
|
|||
xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
|
||||
<!--
|
||||
if you want to run this as a backup on different ports you would need to set the following variable
|
||||
export CLUSTER_PROPS="-Djnp.port=1199 -Djnp.rmiPort=1198 -Djnp.host=localhost -Dactivemq.remoting.netty.host=localhost -Dactivemq.remoting.netty.port=5545 -Dactivemq.remoting.netty.batch.port=5555 -Dactivemq.backup=true"
|
||||
export CLUSTER_PROPS="-Dactivemq.remoting.netty.host=localhost -Dactivemq.remoting.netty.port=5545 -Dactivemq.remoting.netty.batch.port=5555 -Dactivemq.backup=true"
|
||||
-->
|
||||
|
||||
<paging-directory>${data.dir:../data}/paging</paging-directory>
|
||||
|
|
|
@ -2,52 +2,8 @@
|
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd">
|
||||
|
||||
<connection-factory name="NettyXAConnectionFactory">
|
||||
<xa>true</xa>
|
||||
<connectors>
|
||||
<connector-ref connector-name="netty"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="/XAConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory>
|
||||
<queue name="DLQ"/>
|
||||
|
||||
<connection-factory name="NettyConnectionFactory">
|
||||
<xa>false</xa>
|
||||
<connectors>
|
||||
<connector-ref connector-name="netty"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="/ConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory>
|
||||
|
||||
<connection-factory name="NettyThroughputConnectionFactory">
|
||||
<xa>true</xa>
|
||||
<connectors>
|
||||
<connector-ref connector-name="netty-throughput"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="/XAThroughputConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory>
|
||||
|
||||
<connection-factory name="NettyThroughputConnectionFactory">
|
||||
<xa>false</xa>
|
||||
<connectors>
|
||||
<connector-ref connector-name="netty-throughput"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="/ThroughputConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory>
|
||||
|
||||
<queue name="DLQ">
|
||||
<entry name="/queue/DLQ"/>
|
||||
</queue>
|
||||
|
||||
<queue name="ExpiryQueue">
|
||||
<entry name="/queue/ExpiryQueue"/>
|
||||
</queue>
|
||||
<queue name="ExpiryQueue"/>
|
||||
|
||||
</configuration>
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
|
||||
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
|
|
@ -1,75 +0,0 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
<parent>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>activemq-distribution</artifactId>
|
||||
<version>6.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>jnp-client</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>JBoss jnp client jar</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jboss.naming</groupId>
|
||||
<artifactId>jnpserver</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.logging</groupId>
|
||||
<artifactId>jboss-logging</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>org.jboss.naming:jnpserver</include>
|
||||
<artifact>org.jboss.logging:jboss-logging</artifact>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>org.jboss.naming:jnpserver</artifact>
|
||||
<includes>
|
||||
<include>org/jnp/interfaces/**/*.class</include>
|
||||
<include>org/jboss/naming/**/*.class</include>
|
||||
<include>org/jnp/server/NamingServer_Stub.class</include>
|
||||
</includes>
|
||||
</filter>
|
||||
<filter>
|
||||
<artifact>org.jboss.logging:jboss-logging</artifact>
|
||||
<includes>
|
||||
<include>org/jboss/logging/**/*.class</include>
|
||||
</includes>
|
||||
</filter>
|
||||
</filters>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -22,10 +22,6 @@
|
|||
<groupId>org.jboss.spec.javax.jms</groupId>
|
||||
<artifactId>jboss-jms-api_2.0_spec</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.naming</groupId>
|
||||
<artifactId>jnpserver</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-all</artifactId>
|
||||
|
@ -33,7 +29,6 @@
|
|||
</dependencies>
|
||||
|
||||
<modules>
|
||||
<module>jnp-client</module>
|
||||
<module>activemq</module>
|
||||
</modules>
|
||||
|
||||
|
|
|
@ -494,38 +494,35 @@ public class MyMDB implements MessageListener
|
|||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.discovery-initial-wait-timeout">
|
||||
DiscoveryInitialWaitTimeout
|
||||
</link>
|
||||
DiscoveryInitialWaitTimeout
|
||||
</entry>
|
||||
<entry>Long</entry>
|
||||
<entry>The initial time to wait for discovery.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.connection-load-balancing-policy-class-name">
|
||||
ConnectionLoadBalancingPolicyClassName</link>
|
||||
ConnectionLoadBalancingPolicyClassName
|
||||
</entry>
|
||||
<entry>String</entry>
|
||||
<entry>The load balancing policy class to use.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.connection-ttl">ConnectionTTL</link>
|
||||
ConnectionTTL
|
||||
</entry>
|
||||
<entry>Long</entry>
|
||||
<entry>The time to live (in milliseconds) for the connection.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.call-timeout">CallTimeout</link>
|
||||
CallTimeout
|
||||
</entry>
|
||||
<entry>Long</entry>
|
||||
<entry>the call timeout (in milliseconds) for each packet sent.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.dups-ok-batch-size">DupsOKBatchSize</link>
|
||||
DupsOKBatchSize
|
||||
</entry>
|
||||
<entry>Integer</entry>
|
||||
<entry>the batch size (in bytes) between acknowledgements when using
|
||||
|
@ -533,7 +530,7 @@ public class MyMDB implements MessageListener
|
|||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.transaction-batch-size">TransactionBatchSize</link>
|
||||
TransactionBatchSize
|
||||
</entry>
|
||||
<entry>Integer</entry>
|
||||
<entry>the batch size (in bytes) between acknowledgements when using a
|
||||
|
@ -541,70 +538,70 @@ public class MyMDB implements MessageListener
|
|||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.consumer-window-size">ConsumerWindowSize</link>
|
||||
ConsumerWindowSize
|
||||
</entry>
|
||||
<entry>Integer</entry>
|
||||
<entry>the window size (in bytes) for consumer flow control</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.consumer-max-rate">ConsumerMaxRate</link>
|
||||
ConsumerMaxRate
|
||||
</entry>
|
||||
<entry>Integer</entry>
|
||||
<entry>the fastest rate a consumer may consume messages per second</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.confirmation-window-size">ConfirmationWindowSize</link>
|
||||
ConfirmationWindowSize
|
||||
</entry>
|
||||
<entry>Integer</entry>
|
||||
<entry>the window size (in bytes) for reattachment confirmations</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.producer-max-rate">ProducerMaxRate</link>
|
||||
ProducerMaxRate
|
||||
</entry>
|
||||
<entry>Integer</entry>
|
||||
<entry>the maximum rate of messages per second that can be sent</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.min-large-message-size">MinLargeMessageSize</link>
|
||||
MinLargeMessageSize
|
||||
</entry>
|
||||
<entry>Integer</entry>
|
||||
<entry>the size (in bytes) before a message is treated as large </entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.block-on-acknowledge">BlockOnAcknowledge</link>
|
||||
BlockOnAcknowledge
|
||||
</entry>
|
||||
<entry>Boolean</entry>
|
||||
<entry>whether or not messages are acknowledged synchronously</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.block-on-non-durable-send">BlockOnNonDurableSend</link>
|
||||
BlockOnNonDurableSend
|
||||
</entry>
|
||||
<entry>Boolean</entry>
|
||||
<entry>whether or not non-durable messages are sent synchronously</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.block-on-durable-send">BlockOnDurableSend</link>
|
||||
BlockOnDurableSend
|
||||
</entry>
|
||||
<entry>Boolean</entry>
|
||||
<entry>whether or not durable messages are sent synchronously</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.auto-group">AutoGroup</link>
|
||||
AutoGroup
|
||||
</entry>
|
||||
<entry>Boolean</entry>
|
||||
<entry>whether or not message grouping is automatically used</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.pre-acknowledge">PreAcknowledge</link>
|
||||
PreAcknowledge
|
||||
</entry>
|
||||
<entry>Boolean</entry>
|
||||
<entry>whether messages are pre acknowledged by the server before
|
||||
|
@ -612,28 +609,28 @@ public class MyMDB implements MessageListener
|
|||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.reconnect-attempts">ReconnectAttempts</link>
|
||||
ReconnectAttempts
|
||||
</entry>
|
||||
<entry>Integer</entry>
|
||||
<entry>maximum number of retry attempts, default for the resource adapter is -1 (infinite attempts)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.retry-interval">RetryInterval</link>
|
||||
RetryInterval
|
||||
</entry>
|
||||
<entry>Long</entry>
|
||||
<entry>the time (in milliseconds) to retry a connection after failing</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.retry-interval-multiplier">RetryIntervalMultiplier</link>
|
||||
RetryIntervalMultiplier
|
||||
</entry>
|
||||
<entry>Double</entry>
|
||||
<entry>multiplier to apply to successive retry intervals</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.failover-on-server-shutdown">FailoverOnServerShutdown</link>
|
||||
FailoverOnServerShutdown
|
||||
</entry>
|
||||
<entry>Boolean</entry>
|
||||
<entry>If true client will reconnect to another server if
|
||||
|
@ -641,14 +638,14 @@ public class MyMDB implements MessageListener
|
|||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.client-id">ClientID</link>
|
||||
ClientID
|
||||
</entry>
|
||||
<entry>String</entry>
|
||||
<entry>the pre-configured client ID for the connection factory</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.client-failure-check-period">ClientFailureCheckPeriod</link>
|
||||
ClientFailureCheckPeriod
|
||||
</entry>
|
||||
<entry>Long</entry>
|
||||
<entry>the period (in ms) after which the client will consider the
|
||||
|
@ -657,21 +654,21 @@ public class MyMDB implements MessageListener
|
|||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.use-global-pools">UseGlobalPools</link>
|
||||
UseGlobalPools
|
||||
</entry>
|
||||
<entry>Boolean</entry>
|
||||
<entry>whether or not to use a global thread pool for threads</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.scheduled-thread-pool-max-size">ScheduledThreadPoolMaxSize</link>
|
||||
ScheduledThreadPoolMaxSize
|
||||
</entry>
|
||||
<entry>Integer</entry>
|
||||
<entry>the size of the <emphasis>scheduled thread</emphasis> pool</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="configuration.connection-factory.thread-pool-max-size">ThreadPoolMaxSize</link>
|
||||
ThreadPoolMaxSize
|
||||
</entry>
|
||||
<entry>Integer</entry>
|
||||
<entry>the size of the thread pool</entry>
|
||||
|
|
|
@ -47,12 +47,5 @@
|
|||
needed for the <literal>javax.jms.*</literal> classes. If you already have a jar
|
||||
with these interface classes on your classpath, you will not need it.</para>
|
||||
</note>
|
||||
|
||||
</section>
|
||||
<section>
|
||||
<title>JMS Client with JNDI</title>
|
||||
<para>If you are looking up JMS resources from the JNDI server co-located with the ActiveMQ
|
||||
standalone server, you will also need the jar <literal>jnp-client.jar</literal> jar on
|
||||
your client classpath as well as any other jars mentioned previously.</para>
|
||||
</section>
|
||||
</chapter>
|
||||
|
|
|
@ -115,23 +115,16 @@
|
|||
default value is <literal>0</literal>.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>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 <literal>activemq-jms.xml</literal>, for example:</para>
|
||||
<para>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. <literal>jndi.properties</literal>:</para>
|
||||
<programlisting>
|
||||
<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></programlisting>
|
||||
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</programlisting>
|
||||
<para>If you're using JMS, but instantiating your JMS connection factory directly, you can
|
||||
specify the parameters using the appropriate setter methods on the <literal
|
||||
>ActiveMQConnectionFactory</literal> immediately after creating it.</para>
|
||||
|
|
|
@ -378,18 +378,15 @@
|
|||
whether you're using JMS or the core API.</para>
|
||||
<section>
|
||||
<title>Configuring client discovery using JMS</title>
|
||||
<para>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 <literal>activemq-jms.xml</literal>. Let's take a look at an
|
||||
<para>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 <literal>jndi.properties</literal>. Simply ensure the
|
||||
host:port combination matches the group-address and group-port from the corresponding
|
||||
<literal>broadcast-group</literal> on the server. Let's take a look at an
|
||||
example:</para>
|
||||
<programlisting>
|
||||
<connection-factory name="ConnectionFactory">
|
||||
<discovery-group-ref discovery-group-name="my-discovery-group"/>
|
||||
<entries>
|
||||
<entry name="ConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory></programlisting>
|
||||
java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
|
||||
java.naming.provider.url = udp://231.7.7.7:9876</programlisting>
|
||||
<para>The element <literal>discovery-group-ref</literal> specifies the name of a
|
||||
discovery group defined in <literal>activemq-configuration.xml</literal>.</para>
|
||||
<para>When this connection factory is downloaded from JNDI by a client application
|
||||
|
@ -471,27 +468,17 @@ ClientSession session2 = factory.createSession();</programlisting>
|
|||
<para>A static list of possible servers can also be used by a normal client.</para>
|
||||
<section>
|
||||
<title>Configuring client discovery using JMS</title>
|
||||
<para>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 <literal>activemq-jms.xml</literal>. Let's take a look at an
|
||||
example:</para>
|
||||
<para>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. <literal>jndi.properties</literal>:</para>
|
||||
<programlisting>
|
||||
<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></programlisting>
|
||||
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
|
||||
java.naming.provider.url=tcp://myhost:5445,myhost2:5445</programlisting>
|
||||
<para>
|
||||
The element <literal>connectors</literal> contains a list of pre defined connectors in the
|
||||
<literal>activemq-configuration.xml</literal> 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 <literal>java.naming.provider.url</literal> 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 <literal>java.naming.provider.url</literal>.
|
||||
</para>
|
||||
<para>
|
||||
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();</programlisting>
|
|||
<para>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 <literal
|
||||
>org.apache.activemq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy</literal>.</para>
|
||||
<para>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
|
||||
<literal>activemq-jms.xml</literal> configuration file on the server as follows:</para>
|
||||
<para>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.
|
||||
<literal>jndi.properties</literal>, to specify the load balancing policy directly:</para>
|
||||
<programlisting>
|
||||
<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></programlisting>
|
||||
<para>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</programlisting>
|
||||
<para>The above example would instantiate a JMS connection factory that uses the random connection load
|
||||
balancing policy. </para>
|
||||
<para>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
|
||||
|
|
|
@ -73,364 +73,56 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>
|
||||
<link linkend="using-jms.server.configuration">connection-factory</link>
|
||||
</entry>
|
||||
<entry>ConnectionFactory</entry>
|
||||
<entry>a list of connection factories to create and add to JNDI</entry>
|
||||
<entry/>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
<para></para>
|
||||
<para></para>
|
||||
<para>Continued..</para>
|
||||
<informaltable frame="topbot">
|
||||
<tgroup cols="4">
|
||||
<colspec colname="c1" colnum="1"/>
|
||||
<colspec colname="c2" colnum="2"/>
|
||||
<colspec colname="c3" colnum="3"/>
|
||||
<colspec colname="c4" colnum="4"/>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.signature">
|
||||
<link linkend="using-jms.configure.factory.types">connection-factory.signature (attribute)</link>
|
||||
</entry>
|
||||
<entry>String</entry>
|
||||
<entry>Type of connection factory</entry>
|
||||
<entry>generic</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.signature.xa">
|
||||
<link linkend="using-jms.configure.factory.types">connection-factory.xa</link>
|
||||
</entry>
|
||||
<entry>Boolean</entry>
|
||||
<entry>If it is a XA connection factory</entry>
|
||||
<entry>false</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.auto-group">
|
||||
<link linkend="message-grouping.jmsconfigure">connection-factory.auto-group</link>
|
||||
</entry>
|
||||
<entry>Boolean</entry>
|
||||
<entry>whether or not message grouping is automatically used</entry>
|
||||
<entry>false</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="clusters">connection-factory.connectors</link>
|
||||
</entry>
|
||||
<entry>String</entry>
|
||||
<entry>A list of connectors used by the connection factory</entry>
|
||||
<entry />
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="clusters"
|
||||
>connection-factory.connectors.connector-ref.connector-name (attribute)</link>
|
||||
</entry>
|
||||
<entry>String</entry>
|
||||
<entry>Name of the connector to connect to the live server</entry>
|
||||
<entry />
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="clusters"
|
||||
>connection-factory.discovery-group-ref.discovery-group-name (attribute)</link>
|
||||
</entry>
|
||||
<entry>String</entry>
|
||||
<entry>Name of discovery group used by this connection factory</entry>
|
||||
<entry />
|
||||
</row>
|
||||
<row>
|
||||
<!-- FIXME documented but does not exist? -->
|
||||
<entry id="configuration.connection-factory.discovery-initial-wait-timeout">
|
||||
<link linkend="clusters"
|
||||
>connection-factory.discovery-initial-wait-timeout</link>
|
||||
</entry>
|
||||
<entry>Long</entry>
|
||||
<entry>the initial time to wait (in ms) for discovery groups to wait for
|
||||
broadcasts</entry>
|
||||
<entry>10000</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.block-on-acknowledge">
|
||||
<link linkend="send-guarantees.nontrans.acks">connection-factory.block-on-acknowledge</link>
|
||||
</entry>
|
||||
<entry>Boolean</entry>
|
||||
<entry>whether or not messages are acknowledged synchronously</entry>
|
||||
<entry>false</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.block-on-non-durable-send">
|
||||
<link linkend="non-transactional-sends">connection-factory.block-on-non-durable-send</link>
|
||||
</entry>
|
||||
<entry>Boolean</entry>
|
||||
<entry>whether or not non-durable messages are sent synchronously</entry>
|
||||
<entry>false</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.block-on-durable-send">
|
||||
<link linkend="non-transactional-sends">connection-factory.block-on-durable-send</link>
|
||||
</entry>
|
||||
<entry>Boolean</entry>
|
||||
<entry>whether or not durable messages are sent synchronously</entry>
|
||||
<entry>true</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.call-timeout">connection-factory.call-timeout</entry>
|
||||
<entry>Long</entry>
|
||||
<entry>the timeout (in ms) for remote calls</entry>
|
||||
<entry>30000</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.client-failure-check-period">
|
||||
<link linkend="dead.connections">connection-factory.client-failure-check-period</link>
|
||||
</entry>
|
||||
<entry>Long</entry>
|
||||
<entry>the period (in ms) after which the client will consider the
|
||||
connection failed after not receiving packets from the
|
||||
server</entry>
|
||||
<entry>30000</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.client-id">
|
||||
<link linkend="using-jms.clientid">connection-factory.client-id</link>
|
||||
</entry>
|
||||
<entry>String</entry>
|
||||
<entry>the pre-configured client ID for the connection factory</entry>
|
||||
<entry>null</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.connection-load-balancing-policy-class-name">
|
||||
<link linkend="clusters">
|
||||
connection-factory.connection-load-balancing-policy-class-name</link>
|
||||
</entry>
|
||||
<entry>String</entry>
|
||||
<entry>the name of the load balancing class</entry>
|
||||
<entry>org.apache.activemq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.connection-ttl">
|
||||
<link linkend="dead.connections">connection-factory.connection-ttl</link>
|
||||
</entry>
|
||||
<entry>Long</entry>
|
||||
<entry>the time to live (in ms) for connections</entry>
|
||||
<entry>1 * 60000</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.consumer-max-rate">
|
||||
<link linkend="flow-control.rate.core.api">connection-factory.consumer-max-rate</link></entry>
|
||||
<entry>Integer</entry>
|
||||
<entry>the fastest rate a consumer may consume messages per
|
||||
second</entry>
|
||||
<entry>-1</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.consumer-window-size">
|
||||
<link linkend="flow-control.core.api">connection-factory.consumer-window-size</link></entry>
|
||||
<entry>Integer</entry>
|
||||
<entry>the window size (in bytes) for consumer flow control</entry>
|
||||
<entry>1024 * 1024</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.dups-ok-batch-size">
|
||||
<link linkend="using-jms.dupsokbatchsize">connection-factory.dups-ok-batch-size</link></entry>
|
||||
<entry>Integer</entry>
|
||||
<entry>the batch size (in bytes) between acknowledgements when using
|
||||
DUPS_OK_ACKNOWLEDGE mode</entry>
|
||||
<entry>1024 * 1024</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="ha.automatic.failover"
|
||||
>connection-factory.failover-on-initial-connection</link></entry>
|
||||
<entry>Boolean</entry>
|
||||
<entry>whether or not to failover to backup on event that initial connection to live server fails</entry>
|
||||
<entry>false</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.failover-on-server-shutdown">
|
||||
<link linkend="ha.automatic.failover">connection-factory.failover-on-server-shutdown</link></entry>
|
||||
<entry>Boolean</entry>
|
||||
<entry>whether or not to failover on server shutdown</entry>
|
||||
<entry>false</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.min-large-message-size">
|
||||
<link linkend="large-messages.core.config">connection-factory.min-large-message-size</link></entry>
|
||||
<entry>Integer</entry>
|
||||
<entry>the size (in bytes) before a message is treated as large</entry>
|
||||
<entry>100 * 1024</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.avoid-large-messages">
|
||||
<link linkend="large.message.configuring">connection-factory.avoid-large-messages</link></entry>
|
||||
<entry>Boolean</entry>
|
||||
<entry>If compress large messages and send them as regular messages if possible</entry>
|
||||
<entry>false</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="clusters"
|
||||
>connection-factory.cache-large-message-client</link></entry>
|
||||
<entry>Boolean</entry>
|
||||
<entry>If true clients using this connection factory will hold the large
|
||||
message body on temporary files.</entry>
|
||||
<entry>false</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.pre-acknowledge">
|
||||
<link linkend="pre-acknowledge.configure">connection-factory.pre-acknowledge</link></entry>
|
||||
<entry>Boolean</entry>
|
||||
<entry>whether messages are pre acknowledged by the server before
|
||||
sending</entry>
|
||||
<entry>false</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.producer-max-rate">
|
||||
<link linkend="flow-control.producer.rate.core.api">connection-factory.producer-max-rate</link></entry>
|
||||
<entry>Integer</entry>
|
||||
<entry>the maximum rate of messages per second that can be sent</entry>
|
||||
<entry>-1</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="client-reconnection"
|
||||
>connection-factory.producer-window-size</link></entry>
|
||||
<entry>Integer</entry>
|
||||
<entry>the window size in bytes for producers sending messages</entry>
|
||||
<entry>1024 * 1024</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.confirmation-window-size">
|
||||
<link linkend="client-reconnection">connection-factory.confirmation-window-size</link>
|
||||
</entry>
|
||||
<entry>Integer</entry>
|
||||
<entry>the window size (in bytes) for reattachment confirmations</entry>
|
||||
<entry>1024 * 1024</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.reconnect-attempts">
|
||||
<link linkend="client-reconnection">connection-factory.reconnect-attempts</link>
|
||||
</entry>
|
||||
<entry>Integer</entry>
|
||||
<entry>maximum number of retry attempts, -1 signifies infinite</entry>
|
||||
<entry>0</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.retry-interval">
|
||||
<link linkend="client-reconnection">connection-factory.retry-interval</link>
|
||||
</entry>
|
||||
<entry>Long</entry>
|
||||
<entry>the time (in ms) to retry a connection after failing</entry>
|
||||
<entry>2000</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.retry-interval-multiplier">
|
||||
<link linkend="client-reconnection">connection-factory.retry-interval-multiplier</link>
|
||||
</entry>
|
||||
<entry>Double</entry>
|
||||
<entry>multiplier to apply to successive retry intervals</entry>
|
||||
<entry>1.0</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="client-reconnection"
|
||||
>connection-factory.max-retry-interval</link></entry>
|
||||
<entry>Integer</entry>
|
||||
<entry>The maximum retry interval in the case a retry-interval-multiplier has been specified</entry>
|
||||
<entry>2000</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.scheduled-thread-pool-max-size">
|
||||
<link linkend="thread-pooling.client.side">connection-factory.scheduled-thread-pool-max-size</link>
|
||||
</entry>
|
||||
<entry>Integer</entry>
|
||||
<entry>the size of the <emphasis>scheduled thread</emphasis> pool</entry>
|
||||
<entry>5</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.thread-pool-max-size">
|
||||
<link linkend="thread-pooling.client.side">connection-factory.thread-pool-max-size</link>
|
||||
</entry>
|
||||
<entry>Integer</entry>
|
||||
<entry>the size of the thread pool</entry>
|
||||
<entry>-1</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.transaction-batch-size">
|
||||
<link linkend="using-jms.txbatchsize">
|
||||
connection-factory.transaction-batch-size</link>
|
||||
</entry>
|
||||
<entry>Integer</entry>
|
||||
<entry>the batch size (in bytes) between acknowledgements when using a
|
||||
transactional session</entry>
|
||||
<entry>1024 * 1024</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry id="configuration.connection-factory.use-global-pools">
|
||||
<link linkend="thread-pooling.client.side">connection-factory.use-global-pools</link>
|
||||
</entry>
|
||||
<entry>Boolean</entry>
|
||||
<entry>whether or not to use a global thread pool for threads</entry>
|
||||
<entry>true</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="using-jms.server.configuration"
|
||||
>queue</link></entry>
|
||||
<entry><link linkend="using-jms.server.configuration">queue</link></entry>
|
||||
<entry>Queue</entry>
|
||||
<entry>a queue to create and add to JNDI</entry>
|
||||
<entry/>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="using-jms.server.configuration">queue.name
|
||||
(attribute)</link></entry>
|
||||
<entry><link linkend="using-jms.server.configuration">queue.name (attribute)</link></entry>
|
||||
<entry>String</entry>
|
||||
<entry>unique name of the queue</entry>
|
||||
<entry/>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="using-jms.server.configuration"
|
||||
>queue.entry</link></entry>
|
||||
<entry><link linkend="using-jms.server.configuration">queue.entry</link></entry>
|
||||
<entry>String</entry>
|
||||
<entry>context where the queue will be bound in JNDI (there can be
|
||||
many)</entry>
|
||||
<entry>context where the queue will be bound in JNDI (there can be many)</entry>
|
||||
<entry/>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="using-jms.server.configuration"
|
||||
>queue.durable</link></entry>
|
||||
<entry><link linkend="using-jms.server.configuration">queue.durable</link></entry>
|
||||
<entry>Boolean</entry>
|
||||
<entry>is the queue durable?</entry>
|
||||
<entry>true</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="using-jms.server.configuration"
|
||||
>queue.filter</link></entry>
|
||||
<entry><link linkend="using-jms.server.configuration">queue.filter</link></entry>
|
||||
<entry>String</entry>
|
||||
<entry>optional filter expression for the queue</entry>
|
||||
<entry/>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="using-jms.server.configuration"
|
||||
>topic</link></entry>
|
||||
<entry><link linkend="using-jms.server.configuration">topic</link></entry>
|
||||
<entry>Topic</entry>
|
||||
<entry>a topic to create and add to JNDI</entry>
|
||||
<entry/>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="using-jms.server.configuration">topic.name
|
||||
(attribute)</link></entry>
|
||||
<entry><link linkend="using-jms.server.configuration">topic.name (attribute)</link></entry>
|
||||
<entry>String</entry>
|
||||
<entry>unique name of the topic</entry>
|
||||
<entry/>
|
||||
</row>
|
||||
<row>
|
||||
<entry><link linkend="using-jms.server.configuration"
|
||||
>topic.entry</link></entry>
|
||||
<entry><link linkend="using-jms.server.configuration">topic.entry</link></entry>
|
||||
<entry>String</entry>
|
||||
<entry>context where the topic will be bound in JNDI (there can be
|
||||
many)</entry>
|
||||
<entry>context where the topic will be bound in JNDI (there can be many)</entry>
|
||||
<entry/>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<section id="configuration.masked-password">
|
||||
|
|
|
@ -96,25 +96,16 @@
|
|||
to other servers. That's defined by <emphasis>connectors</emphasis>.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>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
|
||||
<literal>ActiveMQConnectionFactory</literal> it needs to know what server
|
||||
that connection factory will create connections to.</para>
|
||||
<para>That's defined by the <literal>connector-ref</literal> element in the <literal
|
||||
>activemq-jms.xml</literal> file on the server side. Let's take a look at a
|
||||
snipped from a <literal>activemq-jms.xml</literal> file that shows a JMS
|
||||
connection factory that references our netty connector defined in our <literal
|
||||
>activemq-configuration.xml</literal> file:</para>
|
||||
<para>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 <literal>ActiveMQConnectionFactory</literal> it needs to know what
|
||||
server that connection factory will create connections to.</para>
|
||||
<para>That's defined by the <literal>java.naming.provider.url</literal> element in the JNDI context
|
||||
environment, e.g. <literal>jndi.properties</literal>. Behind the scenes, the
|
||||
<literal>org.apache.activemq.jndi.ActiveMQInitialContextFactory</literal> uses the
|
||||
<literal>java.naming.provider.url</literal> to construct the transport. Here's a simple example:</para>
|
||||
<programlisting>
|
||||
<connection-factory name="ConnectionFactory">
|
||||
<connectors>
|
||||
<connector-ref connector-name="netty"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="ConnectionFactory"/>
|
||||
<entry name="XAConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory></programlisting>
|
||||
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
|
||||
java.naming.provider.url=tcp://myhost:5445</programlisting>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
|
@ -168,7 +159,7 @@ Connection jmsConnection = connectionFactory.createConnection();
|
|||
|
||||
etc</programlisting>
|
||||
</section>
|
||||
<section>
|
||||
<section id="configuring-transports.netty">
|
||||
<title>Configuring the Netty transport</title>
|
||||
<para>Out of the box, ActiveMQ currently uses <ulink url="http://www.jboss.org/netty/"
|
||||
>Netty</ulink>, a high performance low level network library.</para>
|
||||
|
|
|
@ -111,20 +111,14 @@
|
|||
</section>
|
||||
<section>
|
||||
<title>Using JMS</title>
|
||||
<para>if JNDI is used to look up the connection factory, the consumer window size is
|
||||
configured in <literal>activemq-jms.xml</literal>:</para>
|
||||
<para>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. <literal>jndi.properties</literal>. Here's a
|
||||
simple example using the "ConnectionFactory" connection factory which is available in the context by
|
||||
default:</para>
|
||||
<programlisting>
|
||||
<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></programlisting>
|
||||
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
|
||||
java.naming.provider.url=tcp://localhost:5445
|
||||
connection.ConnectionFactory.consumerWindowSize=0</programlisting>
|
||||
<para>If the connection factory is directly instantiated, the consumer window size is
|
||||
specified by <literal>ActiveMQConnectionFactory.setConsumerWindowSize()</literal>
|
||||
method.</para>
|
||||
|
@ -153,20 +147,13 @@
|
|||
</section>
|
||||
<section>
|
||||
<title>Using JMS</title>
|
||||
<para>If JNDI is used to look up the connection factory, the max rate can be configured
|
||||
in <literal>activemq-jms.xml</literal>:</para>
|
||||
<para>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. <literal>jndi.properties</literal>. Here's a simple example using the
|
||||
"ConnectionFactory" connection factory which is available in the context by default:</para>
|
||||
<programlisting>
|
||||
<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></programlisting>
|
||||
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
|
||||
java.naming.provider.url=tcp://localhost:5445
|
||||
connection.ConnectionFactory.consumerMaxRate=10</programlisting>
|
||||
<para>If the connection factory is directly instantiated, the max rate size can be set
|
||||
via the <literal>ActiveMQConnectionFactory.setConsumerMaxRate(int
|
||||
consumerMaxRate)</literal> method.</para>
|
||||
|
@ -208,18 +195,13 @@
|
|||
</section>
|
||||
<section>
|
||||
<title>Using JMS</title>
|
||||
<para>If JNDI is used to look up the connection factory, the producer window size can be
|
||||
configured in <literal>activemq-jms.xml</literal>:</para>
|
||||
<para>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. <literal>jndi.properties</literal>. Here's a simple
|
||||
example using the "ConnectionFactory" connection factory which is available in the context by default:</para>
|
||||
<programlisting>
|
||||
<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></programlisting>
|
||||
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
|
||||
java.naming.provider.url=tcp://localhost:5445
|
||||
connection.ConnectionFactory.producerWindowSize=10</programlisting>
|
||||
<para>If the connection factory is directly instantiated, the producer window size can
|
||||
be set via the <literal>ActiveMQConnectionFactory.setProducerWindowSize(int
|
||||
producerWindowSize)</literal> method.</para>
|
||||
|
@ -286,29 +268,22 @@
|
|||
<section id="flow-control.producer.rate.core.api">
|
||||
<title>Using Core API</title>
|
||||
<para>If the ActiveMQ core API is being used the rate can be set via the <literal
|
||||
>ServerLocator.setProducerMaxRate(int consumerMaxRate)</literal> method or
|
||||
>ServerLocator.setProducerMaxRate(int producerMaxRate)</literal> method or
|
||||
alternatively via some of the <literal>ClientSession.createProducer()</literal>
|
||||
methods. </para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Using JMS</title>
|
||||
<para>If JNDI is used to look up the connection factory, the max rate can be configured
|
||||
in <literal>activemq-jms.xml</literal>:</para>
|
||||
<para>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. <literal>jndi.properties</literal>. Here's a simple
|
||||
example using the "ConnectionFactory" connection factory which is available in the context by default:</para>
|
||||
<programlisting>
|
||||
<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></programlisting>
|
||||
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
|
||||
java.naming.provider.url=tcp://localhost:5445
|
||||
connection.ConnectionFactory.producerMaxRate=10</programlisting>
|
||||
<para>If the connection factory is directly instantiated, the max rate size can be set
|
||||
via the <literal>ActiveMQConnectionFactory.setProducerMaxRate(int
|
||||
consumerMaxRate)</literal> method.</para>
|
||||
producerMaxRate)</literal> method.</para>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
|
|
|
@ -229,9 +229,8 @@ hq-message-id : STOMP12345</programlisting>
|
|||
<para>Stomp requires the file <literal>jndi.properties</literal> to be available on the
|
||||
classpath. This should look something like:</para>
|
||||
<programlisting>
|
||||
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</programlisting>
|
||||
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory</programlisting>
|
||||
<para>Configure any required JNDI resources in this file according to the documentation.</para>
|
||||
<para>Make sure this file is in the classpath along with the StompConnect jar and the
|
||||
ActiveMQ jars and simply run <literal>java org.codehaus.stomp.jms.Main</literal>.</para>
|
||||
</section>
|
||||
|
|
|
@ -83,21 +83,14 @@ ClientSessionFactory factory = ActiveMQClient.createClientSessionFactory();</pro
|
|||
</section>
|
||||
<section>
|
||||
<title>Using JMS</title>
|
||||
<para>If JNDI is used to look up the connection factory, the minimum large message size
|
||||
is specified in <literal>activemq-jms.xml</literal></para>
|
||||
<programlisting>...
|
||||
<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>
|
||||
...</programlisting>
|
||||
<para>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. <literal>jndi.properties</literal>. Here's a simple
|
||||
example using the "ConnectionFactory" connection factory which is available in the context by default:</para>
|
||||
<programlisting>
|
||||
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
|
||||
java.naming.provider.url=tcp://localhost:5445
|
||||
connection.ConnectionFactory.minLargeMessageSize=250000
|
||||
</programlisting>
|
||||
<para>If the connection factory is being instantiated directly, the minimum large
|
||||
message size is specified by <literal
|
||||
>ActiveMQConnectionFactory.setMinLargeMessageSize</literal>.</para>
|
||||
|
@ -121,17 +114,13 @@ ClientSessionFactory factory = ActiveMQClient.createClientSessionFactory();</pro
|
|||
data directory, thus reducing the disk I/O.</para>
|
||||
</section>
|
||||
<section>
|
||||
<para>If you use JMS, you can achieve large messages compression by configuring your
|
||||
connection factories. For example,</para>
|
||||
<programlisting>...
|
||||
<connection-factory name="ConnectionFactory">
|
||||
<connectors>
|
||||
<connector-ref connector-name="netty"/>
|
||||
</connectors>
|
||||
...
|
||||
<compress-large-messages>true</compress-large-messages>
|
||||
</connection-factory>
|
||||
...</programlisting>
|
||||
<para>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. <literal>jndi.properties</literal>. Here's a simple
|
||||
example using the "ConnectionFactory" connection factory which is available in the context by default:</para>
|
||||
<programlisting>
|
||||
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
|
||||
java.naming.provider.url=tcp://localhost:5445
|
||||
connection.ConnectionFactory.compressLargeMessages=true</programlisting>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
|
|
|
@ -69,21 +69,9 @@
|
|||
<section>
|
||||
<title>Logging in a client or with an Embedded server</title>
|
||||
<para>
|
||||
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.
|
||||
<programlisting>
|
||||
<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></programlisting>
|
||||
The first dependency <literal>jnp-client</literal> 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
|
||||
</para>
|
||||
<para>
|
||||
There are 2 properties you need to set when starting your java program, the first is to set the Log Manager to use
|
||||
|
|
|
@ -77,34 +77,23 @@
|
|||
message = ...
|
||||
message.setStringProperty("JMSXGroupID", "Group-0");
|
||||
producer.send(message);</programlisting>
|
||||
<para>Alternatively, you can set <literal>autogroup</literal> to true on the <literal
|
||||
>ActiveMQConnectonFactory</literal> which will pick a random unique id. This can also be
|
||||
set in the <literal>activemq-jms.xml</literal> file like this:</para>
|
||||
<para>Alternatively, you can set <literal>autogroup</literal> to true on the
|
||||
<literal>ActiveMQConnectonFactory</literal> which will pick a random unique id. This can also be set in the
|
||||
JNDI context environment, e.g. <literal>jndi.properties</literal>. Here's a simple example using the
|
||||
"ConnectionFactory" connection factory which is available in the context by default</para>
|
||||
<programlisting>
|
||||
<connection-factory name="ConnectionFactory">
|
||||
<connectors>
|
||||
<connector-ref connector-name="netty-connector"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="ConnectionFactory"/>
|
||||
</entries>
|
||||
<autogroup>true</autogroup>
|
||||
</connection-factory></programlisting>
|
||||
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
|
||||
java.naming.provider.url=tcp://localhost:5445
|
||||
connection.ConnectionFactory.autoGroup=true</programlisting>
|
||||
<para>Alternatively you can set the group id via the connection factory. All messages sent
|
||||
with producers created via this connection factory will set the <literal
|
||||
>JMSXGroupID</literal> to the specified value on all messages sent. To configure the
|
||||
group id set it on the connection factory in the <literal>activemq-jms.xml</literal> config
|
||||
file as follows
|
||||
>JMSXGroupID</literal> to the specified value on all messages sent. This can also be set in the
|
||||
JNDI context environment, e.g. <literal>jndi.properties</literal>. Here's a simple example using the
|
||||
"ConnectionFactory" connection factory which is available in the context by default:</para>
|
||||
<programlisting>
|
||||
<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></programlisting></para>
|
||||
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
|
||||
java.naming.provider.url=tcp://localhost:5445
|
||||
connection.ConnectionFactory.groupID=Group-0</programlisting>
|
||||
</section>
|
||||
<section>
|
||||
<title>Example</title>
|
||||
|
|
|
@ -57,18 +57,12 @@
|
|||
</note>
|
||||
<section id="pre-acknowledge.configure">
|
||||
<title>Using PRE_ACKNOWLEDGE</title>
|
||||
<para>This can be configured in the <literal>activemq-jms.xml</literal> file on the <literal
|
||||
>connection factory</literal> like this:</para>
|
||||
<para>This can be configured in a client's JNDI context environment, e.g. <literal>jndi.properties</literal>,
|
||||
like this:</para>
|
||||
<programlisting>
|
||||
<connection-factory name="ConnectionFactory">
|
||||
<connectors>
|
||||
<connector-ref connector-name="netty-connector"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="ConnectionFactory"/>
|
||||
</entries>
|
||||
<pre-acknowledge>true</pre-acknowledge>
|
||||
</connection-factory></programlisting>
|
||||
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
|
||||
java.naming.provider.url=tcp://localhost:5445
|
||||
connection.ConnectionFactory.preAcknowledge=true</programlisting>
|
||||
<para>Alternatively, to use pre-acknowledgement mode using the JMS API, create a JMS Session
|
||||
with the <literal>ActiveMQSession.PRE_ACKNOWLEDGE</literal> constant.</para>
|
||||
<programlisting>
|
||||
|
|
|
@ -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></programlisting>
|
||||
<para>Here we've specified a
|
||||
<literal>javax.jms.ConnectionFactory</literal> we want bound to a
|
||||
|
|
|
@ -137,20 +137,14 @@ myFactory.setThreadPoolMaxSize(-1); </programlisting>
|
|||
<programlisting>
|
||||
ConnectionFactory myConnectionFactory = ActiveMQJMSClient.createConnectionFactory(myFactory);</programlisting>
|
||||
<para>If you're using JNDI to instantiate <literal>ActiveMQConnectionFactory</literal>
|
||||
instances, you can also set these parameters in the <literal>activemq-jms.xml</literal>
|
||||
file where you describe your connection factory, for example:</para>
|
||||
instances, you can also set these parameters in the JNDI context environment, e.g.
|
||||
<literal>jndi.properties</literal>. Here's a simple example using the "ConnectionFactory" connection
|
||||
factory which is available in the context by default:</para>
|
||||
<programlisting>
|
||||
<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></programlisting>
|
||||
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</programlisting>
|
||||
</section>
|
||||
</chapter>
|
||||
|
|
|
@ -49,210 +49,262 @@
|
|||
server JMS configuration so it is created automatically without us having to explicitly
|
||||
create it from the client.</para>
|
||||
</section>
|
||||
<section id="using-jms.server.configuration">
|
||||
<title>JMS Server Configuration</title>
|
||||
<para>The file <literal>activemq-jms.xml</literal> 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.</para>
|
||||
<para>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.</para>
|
||||
<para>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:</para>
|
||||
<programlisting>
|
||||
<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></programlisting>
|
||||
<para>We deploy one ConnectionFactory called <literal>ConnectionFactory</literal> and bind
|
||||
it in just one place in JNDI as given by the <literal>entry</literal> element.
|
||||
ConnectionFactory instances can be bound in many places in JNDI if you require. </para>
|
||||
<section id="using-jms.jndi.configuration">
|
||||
<title>JNDI Configuration</title>
|
||||
<para>The JMS specification establishes the convention that <emphasis>administered
|
||||
objects</emphasis> (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.</para>
|
||||
<note>
|
||||
<para>The JMS connection factory references a <literal>connector</literal> called
|
||||
<literal>netty</literal>. This is a reference to a connector object deployed in
|
||||
the main core configuration file <literal>activemq-configuration.xml</literal> which
|
||||
defines the transport and parameters used to actually connect to the server.</para>
|
||||
<para>The following configuration properties <emphasis>are strictly required when ActiveMQ
|
||||
is running in stand-alone mode</emphasis>. 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.</para>
|
||||
</note>
|
||||
</section>
|
||||
<section id="using-jms.configure.factory.types">
|
||||
<title>Connection Factory Types</title>
|
||||
<para>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 <literal>signature</literal> attribute and a <literal>xa</literal> parameter, the
|
||||
combination of which determines the type of the factory. Attribute <literal>signature</literal>
|
||||
has three possible string values, i.e. <emphasis>generic</emphasis>,
|
||||
<emphasis>queue</emphasis> and <emphasis>topic</emphasis>; <literal>xa</literal> is a boolean
|
||||
type parameter. The following table gives their configuration values for different
|
||||
connection factory interfaces.</para>
|
||||
<table frame="topbot" id="using-jms.table.configure.factory.types">
|
||||
<section>
|
||||
<title>ConnectionFactory JNDI</title>
|
||||
<para>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.</para>
|
||||
<para>By default, a <literal>javax.naming.Context</literal> instance created using the
|
||||
<literal>org.apache.activemq.jndi.ActiveMQInitialContextFactory</literal> will automatically
|
||||
have the following connection factories available for lookup:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para><literal>ConnectionFactory</literal></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><literal>XAConnectionFactory</literal></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><literal>QueueConnectionFactory</literal></para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><literal>TopicConnectionFactory</literal></para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>Here's a simple example of the JNDI context environment for a client looking up a connection factory
|
||||
to access an <emphasis>embedded</emphasis> instance of ActiveMQ:</para>
|
||||
<programlisting>
|
||||
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory</programlisting>
|
||||
<para>It's really as simple as that. As noted previously, any JNDI context created with the
|
||||
<literal>ActiveMQInitialContextFactory</literal> will have a set of default connection factories
|
||||
available. Therefore, only the <literal>java.naming.factory.initial</literal> property is required
|
||||
to access an embedded broker.</para>
|
||||
<para>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
|
||||
<literal>javax.naming.Context.PROVIDER_URL</literal> (<literal>String</literal> value of
|
||||
"java.naming.provider.url") in the JNDI environment like <literal>vm://2</literal> where
|
||||
<literal>2</literal> is the server-ID for acceptor.</para>
|
||||
<para>Here is a list of all the supported URL schemes:</para>
|
||||
<itemizedlist>
|
||||
<listitem><para><literal>vm</literal></para></listitem>
|
||||
<listitem><para><literal>tcp</literal></para></listitem>
|
||||
<listitem><para><literal>udp</literal></para></listitem>
|
||||
<listitem><para><literal>jgroups</literal></para></listitem>
|
||||
</itemizedlist>
|
||||
<para>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
|
||||
<literal>javax.naming.Context.PROVIDER_URL</literal> (<literal>String</literal> 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:</para>
|
||||
<programlisting>
|
||||
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
|
||||
java.naming.provider.url=tcp://myhost:5445</programlisting>
|
||||
<para>In the example above the client is using the <literal>tcp</literal> scheme for the provider URL.
|
||||
A client may also specify multiple comma-delimited host:port combinations in the URL (e.g.
|
||||
<literal>tcp://remote-host1:5445,remote-host2:5445</literal>). Whether there is one or many
|
||||
host:port combinations in the URL they are treated as the <emphasis>initial connector(s)</emphasis>
|
||||
for the underlying connection.</para>
|
||||
<para>The <literal>udp</literal> scheme is also supported which should use an host:port combination that
|
||||
matches the <literal>group-address</literal> and <literal>group-port</literal> from the corresponding
|
||||
<literal>broadcast-group</literal> configured on the ActiveMQ server(s).</para>
|
||||
<para>Each scheme has a specific set of properties which can be set using the traditional URL query string
|
||||
format (e.g. <literal>scheme://host:port?key1=value1&key2=value2</literal>) 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 <literal>Context.PROVIDER_URL</literal> of
|
||||
<literal>tcp://remote-host:5445?ssl-enabled=true</literal>.</para>
|
||||
<para>All the properties available for the <literal>tcp</literal> scheme are described in
|
||||
<link linkend="configuring-transports.netty">the documentation regarding the Netty transport</link>.</para>
|
||||
<para>The <literal>udp</literal> scheme supports 4 properties:</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para><literal>local-address</literal> - 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.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><literal>local-port</literal> - 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
|
||||
<literal>local-address</literal>.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><literal>refresh-timeout</literal> - 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).</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><literal>discovery-initial-wait-timeout</literal> - 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.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>Lastly, the <literal>jgroups</literal> scheme is supported which provides an alternative to the
|
||||
<literal>udp</literal> scheme for server discovery. The URL pattern is as follows
|
||||
<literal>jgroups://<jgroups-xml-conf-filename></literal> where
|
||||
<literal><jgroups-xml-conf-filename></literal> refers to an XML file on the classpath that contains
|
||||
the JGroups configuration.</para>
|
||||
<para>The <literal>refresh-timeout</literal> and <literal>discovery-initial-wait-timeout</literal> properties
|
||||
are supported just like with <literal>udp</literal>.</para>
|
||||
<para>Although a <literal>javax.naming.Context</literal> instance created using the
|
||||
<literal>org.apache.activemq.jndi.ActiveMQInitialContextFactory</literal> will automatically
|
||||
have some connection factories present, it is possible for a client to specify its own connection
|
||||
factories. This is done using the
|
||||
<literal>org.apache.activemq.jndi.ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES</literal>
|
||||
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:</para>
|
||||
<programlisting>
|
||||
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
|
||||
java.naming.provider.url=tcp://localhost:5445
|
||||
connectionFactoryNames=myConnectionFactory</programlisting>
|
||||
<para>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.</para>
|
||||
<para>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:
|
||||
<literal>connection.<connection-factory-name>.<property-name></literal>. For example, if the
|
||||
client wanted to customize the default connection factory "ConnectionFactory" to support
|
||||
high-availability then it would do this:</para>
|
||||
<programlisting>
|
||||
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
|
||||
java.naming.provider.url=tcp://myhost:5445
|
||||
connection.ConnectionFactory.ha=true</programlisting>
|
||||
<para>Any property available on the underlying
|
||||
<literal>org.apache.activemq.jms.client.ActiveMQConnectionFactory</literal> can be set this way in
|
||||
addition to the <literal>ha</literal> (boolean) and <literal>type</literal> (String) properties. Here
|
||||
are the different options for the <literal>type</literal>:</para>
|
||||
<table frame="topbot" id="using-jms.table.configure.factory.types">
|
||||
<title>Configuration for Connection Factory Types</title>
|
||||
<tgroup cols="3">
|
||||
<colspec colname="signature" colnum="1"/>
|
||||
<colspec colname="xa" colnum="2"/>
|
||||
<colspec colname="cftype" colnum="3"/>
|
||||
<colspec colname="cftype" colnum="1"/>
|
||||
<colspec colname="interface" colnum="2"/>
|
||||
<thead>
|
||||
<row>
|
||||
<entry>signature</entry>
|
||||
<entry>xa</entry>
|
||||
<entry>Connection Factory Type</entry>
|
||||
<entry>type</entry>
|
||||
<entry>interface</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>generic (default)</entry>
|
||||
<entry>false (default)</entry>
|
||||
<entry>CF (default)</entry>
|
||||
<entry>javax.jms.ConnectionFactory</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>generic</entry>
|
||||
<entry>true</entry>
|
||||
<entry>XA_CF</entry>
|
||||
<entry>javax.jms.XAConnectionFactory</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>queue</entry>
|
||||
<entry>false</entry>
|
||||
<entry>QUEUE_CF</entry>
|
||||
<entry>javax.jms.QueueConnectionFactory</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>queue</entry>
|
||||
<entry>true</entry>
|
||||
<entry>QUEUE_XA_CF</entry>
|
||||
<entry>javax.jms.XAQueueConnectionFactory</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>topic</entry>
|
||||
<entry>false</entry>
|
||||
<entry>TOPIC_CF</entry>
|
||||
<entry>javax.jms.TopicConnectionFactory</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>topic</entry>
|
||||
<entry>true</entry>
|
||||
<entry>TOPIC_XA_CF</entry>
|
||||
<entry>javax.jms.XATopicConnectionFactory</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
<para>As an example, the following configures an XAQueueConnectionFactory:</para>
|
||||
<programlisting>
|
||||
<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" signature="queue">
|
||||
<xa>true</xa>
|
||||
<connectors>
|
||||
<connector-ref connector-name="netty"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="ConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory>
|
||||
</configuration></programlisting>
|
||||
|
||||
</section>
|
||||
<section>
|
||||
<title>JNDI configuration</title>
|
||||
<para>When using JNDI from the client side you need to specify a set of JNDI properties
|
||||
which tell the JNDI client where to locate the JNDI server, amongst other things. These
|
||||
are often specified in a file called <literal>jndi.properties</literal> on the client
|
||||
classpath, or you can specify them directly when creating the JNDI initial context. A
|
||||
full JNDI tutorial is outside the scope of this document, please see the <ulink
|
||||
url="http://docs.oracle.com/javase/jndi/tutorial">Sun JNDI tutorial</ulink>
|
||||
for more information on how to use JNDI.</para>
|
||||
<para>For talking to the JBoss JNDI Server, the jndi properties will look something like
|
||||
this:</para>
|
||||
<programlisting>
|
||||
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
|
||||
java.naming.provider.url=jnp://myhost:1099
|
||||
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces</programlisting>
|
||||
<para>Where <literal>myhost</literal> is the hostname or IP address of the JNDI server. 1099
|
||||
is the port used by the JNDI server and may vary depending on how you have configured
|
||||
your JNDI server.</para>
|
||||
<para>In the default standalone configuration, JNDI server ports are configured in the file
|
||||
<literal>activemq-beans.xml</literal> by setting properties on the <literal
|
||||
>JNDIServer</literal> bean:</para>
|
||||
<programlisting>
|
||||
<bean name="StandaloneServer" class="org.apache.activemq.jms.server.impl.StandaloneNamingServer">
|
||||
<constructor>
|
||||
<parameter>
|
||||
<inject bean="ActiveMQServer"/>
|
||||
</parameter>
|
||||
</constructor>
|
||||
<property name="port">${jnp.port:1099}</property>
|
||||
<property name="bindAddress">${jnp.host:localhost}</property>
|
||||
<property name="rmiPort">${jnp.rmiPort:1098}</property>
|
||||
<property name="rmiBindAddress">${jnp.host:localhost}</property>
|
||||
</bean></programlisting>
|
||||
<note>
|
||||
<para>If you want your JNDI server to be available to non local clients make sure you
|
||||
change its bind address to something other than <literal
|
||||
>localhost</literal>!</para>
|
||||
</note>
|
||||
<note>
|
||||
<para>The JNDIServer bean must be defined <emphasis>only when ActiveMQ is running in
|
||||
stand-alone mode</emphasis>. When ActiveMQ is integrated to JBoss Application
|
||||
Server, JBoss AS will provide a ready-to-use JNDI server without any additional
|
||||
configuration.</para>
|
||||
</note>
|
||||
</section>
|
||||
<section>
|
||||
<title>The code</title>
|
||||
<para>Here's the code for the example:</para>
|
||||
<para>First we'll create a JNDI initial context from which to lookup our JMS objects:</para>
|
||||
<programlisting>InitialContext ic = new InitialContext();</programlisting>
|
||||
<para>Now we'll look up the connection factory:</para>
|
||||
<programlisting>ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");</programlisting>
|
||||
<para>And look up the Queue:</para>
|
||||
<programlisting>Queue orderQueue = (Queue)ic.lookup("/queues/OrderQueue");</programlisting>
|
||||
<para>Next we create a JMS connection using the connection factory:</para>
|
||||
<programlisting>Connection connection = cf.createConnection();</programlisting>
|
||||
<para>And we create a non transacted JMS Session, with AUTO_ACKNOWLEDGE acknowledge
|
||||
mode:</para>
|
||||
<programlisting>Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);</programlisting>
|
||||
<para>We create a MessageProducer that will send orders to the queue:</para>
|
||||
<programlisting>MessageProducer producer = session.createProducer(orderQueue);</programlisting>
|
||||
<para>And we create a MessageConsumer which will consume orders from the queue:</para>
|
||||
<programlisting>MessageConsumer consumer = session.createConsumer(orderQueue);</programlisting>
|
||||
<para>We make sure we start the connection, or delivery won't occur on it:</para>
|
||||
<programlisting>connection.start();</programlisting>
|
||||
<para>We create a simple TextMessage and send it:</para>
|
||||
<programlisting>TextMessage message = session.createTextMessage("This is an order");
|
||||
</section>
|
||||
<section>
|
||||
<title>Destination JNDI</title>
|
||||
<para>JMS destinations are also typically looked up via JNDI. As with connection factories, destinations can
|
||||
be configured using special properties in the JNDI context environment. The property
|
||||
<emphasis>name</emphasis> should follow the pattern: <literal>queue.<jndi-binding></literal> or
|
||||
<literal>topic.<jndi-binding></literal>. The property <emphasis>value</emphasis> should be the name
|
||||
of the queue hosted by the ActiveMQ server. For example, if the server had a JMS queue configured like
|
||||
so:</para>
|
||||
<programlisting>
|
||||
<queue name="OrderQueue"/></programlisting>
|
||||
<para>And if the client wanted to bind this queue to "queues/OrderQueue" then the JNDI properties would be
|
||||
configured like so:</para>
|
||||
<programlisting>
|
||||
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
|
||||
java.naming.provider.url=tcp://myhost:5445
|
||||
queue.queues/OrderQueue=OrderQueue</programlisting>
|
||||
<para>It is also possible to look-up JMS destinations which haven't been configured explicitly in the JNDI
|
||||
context environment. This is possible using <literal>dynamicQueues/</literal> or
|
||||
<literal>dynamicTopics/</literal> in the look-up string. For example, if the client wanted to look-up the
|
||||
aforementioned "OrderQueue" it could do so simply by using the string "dynamicQueues/OrderQueue". Note,
|
||||
the text that follows <literal>dynamicQueues/</literal> or <literal>dynamicTopics/</literal> must
|
||||
correspond <emphasis>exactly</emphasis> to the name of the destination on the server.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>The code</title>
|
||||
<para>Here's the code for the example:</para>
|
||||
<para>First we'll create a JNDI initial context from which to lookup our JMS objects. If the above
|
||||
properties are set in <literal>jndi.properties</literal> and it is on the classpath then any new, empty
|
||||
<literal>InitialContext</literal> will be initialized using those properties:</para>
|
||||
<programlisting>InitialContext ic = new InitialContext();</programlisting>
|
||||
<para>Now we'll look up the connection factory from which we can create connections to myhost:5445:</para>
|
||||
<programlisting>ConnectionFactory cf = (ConnectionFactory)ic.lookup("ConnectionFactory");</programlisting>
|
||||
<para>And look up the Queue:</para>
|
||||
<programlisting>Queue orderQueue = (Queue)ic.lookup("queues/OrderQueue");</programlisting>
|
||||
<para>Next we create a JMS connection using the connection factory:</para>
|
||||
<programlisting>Connection connection = cf.createConnection();</programlisting>
|
||||
<para>And we create a non transacted JMS Session, with AUTO_ACKNOWLEDGE acknowledge
|
||||
mode:</para>
|
||||
<programlisting>Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);</programlisting>
|
||||
<para>We create a MessageProducer that will send orders to the queue:</para>
|
||||
<programlisting>MessageProducer producer = session.createProducer(orderQueue);</programlisting>
|
||||
<para>And we create a MessageConsumer which will consume orders from the queue:</para>
|
||||
<programlisting>MessageConsumer consumer = session.createConsumer(orderQueue);</programlisting>
|
||||
<para>We make sure we start the connection, or delivery won't occur on it:</para>
|
||||
<programlisting>connection.start();</programlisting>
|
||||
<para>We create a simple TextMessage and send it:</para>
|
||||
<programlisting>TextMessage message = session.createTextMessage("This is an order");
|
||||
producer.send(message);</programlisting>
|
||||
<para>And we consume the message:</para>
|
||||
<programlisting>TextMessage receivedMessage = (TextMessage)consumer.receive();
|
||||
<para>And we consume the message:</para>
|
||||
<programlisting>TextMessage receivedMessage = (TextMessage)consumer.receive();
|
||||
System.out.println("Got order: " + receivedMessage.getText());</programlisting>
|
||||
<para>It is as simple as that. For a wide range of working JMS examples please see the
|
||||
examples directory in the distribution.</para>
|
||||
<warning>
|
||||
<para>Please note that JMS connections, sessions, producers and consumers are
|
||||
<emphasis>designed to be re-used</emphasis>.</para>
|
||||
<para>It is an anti-pattern to create new connections, sessions, producers and consumers
|
||||
for each message you produce or consume. If you do this, your application will
|
||||
perform very poorly. This is discussed further in the section on performance tuning
|
||||
<xref linkend="perf-tuning"/>.</para>
|
||||
</warning>
|
||||
<para>It is as simple as that. For a wide range of working JMS examples please see the
|
||||
examples directory in the distribution.</para>
|
||||
<warning>
|
||||
<para>Please note that JMS connections, sessions, producers and consumers are
|
||||
<emphasis>designed to be re-used</emphasis>.</para>
|
||||
<para>It is an anti-pattern to create new connections, sessions, producers and consumers
|
||||
for each message you produce or consume. If you do this, your application will
|
||||
perform very poorly. This is discussed further in the section on performance tuning
|
||||
<xref linkend="perf-tuning"/>.</para>
|
||||
</warning>
|
||||
</section>
|
||||
</section>
|
||||
<section>
|
||||
<title>Directly instantiating JMS Resources without using JNDI</title>
|
||||
<para>Although it is a very common JMS usage pattern to lookup JMS <emphasis>Administered
|
||||
Objects</emphasis> (that's JMS Queue, Topic and ConnectionFactory instances) from
|
||||
JNDI, in some cases a JNDI server is not available and you still want to use JMS, or you
|
||||
just think "Why do I need JNDI? Why can't I just instantiate these objects
|
||||
directly?"</para>
|
||||
Objects</emphasis> (that's JMS Queue, Topic and ConnectionFactory instances) from JNDI,
|
||||
in some cases you just think "Why do I need JNDI? Why can't I just instantiate these
|
||||
objects directly?"</para>
|
||||
<para>With ActiveMQ you can do exactly that. ActiveMQ supports the direct instantiation of JMS
|
||||
Queue, Topic and ConnectionFactory instances, so you don't have to use JNDI at
|
||||
all.</para>
|
||||
|
|
|
@ -37,11 +37,6 @@
|
|||
<artifactId>jboss-jms-api</artifactId>
|
||||
<version>1.1.0.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.naming</groupId>
|
||||
<artifactId>jnp-client</artifactId>
|
||||
<version>5.0.5.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.spec.javax.jms</groupId>
|
||||
<artifactId>jboss-jms-api_2.0_spec</artifactId>
|
||||
|
|
|
@ -37,11 +37,6 @@
|
|||
<artifactId>jboss-jms-api</artifactId>
|
||||
<version>1.1.0.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.naming</groupId>
|
||||
<artifactId>jnp-client</artifactId>
|
||||
<version>5.0.5.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.spec.javax.jms</groupId>
|
||||
<artifactId>jboss-jms-api_2.0_spec</artifactId>
|
||||
|
|
|
@ -33,11 +33,6 @@
|
|||
<artifactId>jboss-jms-api</artifactId>
|
||||
<version>1.1.0.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.naming</groupId>
|
||||
<artifactId>jnp-client</artifactId>
|
||||
<version>5.0.5.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq.examples.jms</groupId>
|
||||
<artifactId>activemq-jms-examples-common</artifactId>
|
||||
|
@ -118,11 +113,6 @@
|
|||
<artifactId>jboss-jms-api</artifactId>
|
||||
<version>1.1.0.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.naming</groupId>
|
||||
<artifactId>jnpserver</artifactId>
|
||||
<version>5.0.3.GA</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
|
|
@ -41,11 +41,6 @@
|
|||
<artifactId>jboss-jms-api</artifactId>
|
||||
<version>1.1.0.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.naming</groupId>
|
||||
<artifactId>jnp-client</artifactId>
|
||||
<version>5.0.5.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.spec.javax.jms</groupId>
|
||||
<artifactId>jboss-jms-api_2.0_spec</artifactId>
|
||||
|
@ -148,11 +143,6 @@
|
|||
<artifactId>jboss-jms-api</artifactId>
|
||||
<version>1.1.0.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.naming</groupId>
|
||||
<artifactId>jnpserver</artifactId>
|
||||
<version>5.0.3.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.vertx</groupId>
|
||||
<artifactId>vertx-core</artifactId>
|
||||
|
|
|
@ -1,19 +1,8 @@
|
|||
<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="netty-connector"/>
|
||||
</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>
|
|
@ -1 +1 @@
|
|||
server.args=-XX:+UseParallelGC -Xms256M -Xmx256M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
|
||||
server.args=-XX:+UseParallelGC -Xms256M -Xmx256M -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Djava.util.logging.config.file=${imported.basedir}/config/logging.properties -Djava.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
|
|
@ -180,9 +180,10 @@ public abstract class ActiveMQExample
|
|||
{
|
||||
ActiveMQExample.log.info("using " + args[serverId] + " for jndi");
|
||||
Properties props = new Properties();
|
||||
props.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
|
||||
props.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
|
||||
props.put("java.naming.provider.url", args[serverId]);
|
||||
props.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
|
||||
props.put("queue.queue/exampleQueue", "exampleQueue");
|
||||
props.put("topic.topic/exampleTopic", "exampleTopic");
|
||||
return new InitialContext(props);
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
<configuration>
|
||||
<clientClass>org.apache.activemq.jms.example.AerogearExample</clientClass>
|
||||
<args>
|
||||
<param>jnp://localhost:1099</param>
|
||||
<param>tcp://localhost:5445</param>
|
||||
</args>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
@ -122,11 +122,6 @@
|
|||
<artifactId>jboss-jms-api</artifactId>
|
||||
<version>1.1.0.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.naming</groupId>
|
||||
<artifactId>jnpserver</artifactId>
|
||||
<version>5.0.3.GA</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<waitOnStart>false</waitOnStart>
|
||||
|
|
|
@ -51,10 +51,10 @@ public class AerogearExample extends ActiveMQExample
|
|||
initialContext = getContext(0);
|
||||
|
||||
// Step 2. Perfom a lookup on the queue
|
||||
Queue queue = (Queue)initialContext.lookup("/queue/aerogearQueue");
|
||||
Queue queue = (Queue)initialContext.lookup("queue/exampleQueue");
|
||||
|
||||
// Step 3. Perform a lookup on the Connection Factory
|
||||
ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");
|
||||
ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory");
|
||||
|
||||
// Step 4.Create a JMS Connection
|
||||
connection = cf.createConnection();
|
||||
|
|
|
@ -1,19 +1,8 @@
|
|||
<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="netty-connector"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="ConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory>
|
||||
|
||||
<!--the queue used by the example-->
|
||||
<queue name="aerogearQueue">
|
||||
<entry name="/queue/aerogearQueue"/>
|
||||
</queue>
|
||||
<queue name="aerogearQueue"/>
|
||||
|
||||
</configuration>
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
<configuration>
|
||||
<clientClass>org.apache.activemq.jms.example.AppletExample</clientClass>
|
||||
<args>
|
||||
<param>jnp://localhost:1099</param>
|
||||
<param>tcp://localhost:5445</param>
|
||||
</args>
|
||||
<systemProperties>
|
||||
<property>
|
||||
|
@ -107,11 +107,6 @@
|
|||
<artifactId>jboss-jms-api</artifactId>
|
||||
<version>1.1.0.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.naming</groupId>
|
||||
<artifactId>jnpserver</artifactId>
|
||||
<version>5.0.3.GA</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<waitOnStart>false</waitOnStart>
|
||||
|
|
|
@ -1,19 +1,8 @@
|
|||
<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="netty-connector"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="ConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory>
|
||||
|
||||
<!--the topic used by the example-->
|
||||
<topic name="exampleTopic">
|
||||
<entry name="/topic/exampleTopic"/>
|
||||
</topic>
|
||||
<topic name="exampleTopic"/>
|
||||
|
||||
</configuration>
|
|
@ -60,8 +60,8 @@
|
|||
<configuration>
|
||||
<clientClass>org.apache.activemq.jms.example.ApplicationLayerFailoverExample</clientClass>
|
||||
<args>
|
||||
<param>jnp://localhost:1099</param>
|
||||
<param>jnp://localhost:1199</param>
|
||||
<param>tcp://localhost:5445</param>
|
||||
<param>tcp://localhost:5446</param>
|
||||
</args>
|
||||
<systemProperties>
|
||||
<property>
|
||||
|
@ -126,11 +126,6 @@
|
|||
<artifactId>jboss-jms-api</artifactId>
|
||||
<version>1.1.0.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.naming</groupId>
|
||||
<artifactId>jnpserver</artifactId>
|
||||
<version>5.0.3.GA</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<waitOnStart>false</waitOnStart>
|
||||
|
|
|
@ -152,10 +152,10 @@ public class ApplicationLayerFailoverExample extends ActiveMQExample
|
|||
initialContext = getContext(server);
|
||||
|
||||
// Step 2. Look-up the JMS Queue object from JNDI
|
||||
Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue");
|
||||
Queue queue = (Queue)initialContext.lookup("queue/exampleQueue");
|
||||
|
||||
// Step 3. Look-up a JMS Connection Factory object from JNDI on server 1
|
||||
ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");
|
||||
ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("ConnectionFactory");
|
||||
|
||||
// Step 4. We create a JMS Connection connection
|
||||
connection = connectionFactory.createConnection();
|
||||
|
|
|
@ -1,19 +1,8 @@
|
|||
<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="netty-connector"/>
|
||||
</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>
|
||||
|
|
|
@ -1,19 +1,8 @@
|
|||
<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="netty-connector"/>
|
||||
</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>
|
||||
|
|
|
@ -64,8 +64,8 @@
|
|||
<configuration>
|
||||
<clientClass>org.apache.activemq.jms.example.BridgeExample</clientClass>
|
||||
<args>
|
||||
<param>jnp://localhost:1099</param>
|
||||
<param>jnp://localhost:1199</param>
|
||||
<param>tcp://localhost:5445</param>
|
||||
<param>tcp://localhost:5446</param>
|
||||
</args>
|
||||
<systemProperties>
|
||||
<property>
|
||||
|
@ -130,11 +130,6 @@
|
|||
<artifactId>jboss-jms-api</artifactId>
|
||||
<version>1.1.0.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.naming</groupId>
|
||||
<artifactId>jnpserver</artifactId>
|
||||
<version>5.0.3.GA</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<waitOnStart>false</waitOnStart>
|
||||
|
|
|
@ -59,11 +59,11 @@ public class BridgeExample extends ActiveMQExample
|
|||
|
||||
// Step 2 - we look up the sausage-factory queue from node 0
|
||||
|
||||
Queue sausageFactory = (Queue)ic0.lookup("/queue/sausage-factory");
|
||||
Queue sausageFactory = (Queue)ic0.lookup("queue/exampleQueue");
|
||||
|
||||
// Step 3 - we look up a JMS ConnectionFactory object from node 0
|
||||
|
||||
ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("/ConnectionFactory");
|
||||
ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("ConnectionFactory");
|
||||
|
||||
// Step 4 - we create an initial context for looking up JNDI on node 1
|
||||
|
||||
|
@ -71,11 +71,11 @@ public class BridgeExample extends ActiveMQExample
|
|||
|
||||
// Step 5 - we look up the mincing-machine queue on node 1
|
||||
|
||||
Queue mincingMachine = (Queue)ic1.lookup("/queue/mincing-machine");
|
||||
Queue mincingMachine = (Queue)ic1.lookup("queue/exampleQueue1");
|
||||
|
||||
// Step 6 - we look up a JMS ConnectionFactory object from node 1
|
||||
|
||||
ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("/ConnectionFactory");
|
||||
ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("ConnectionFactory");
|
||||
|
||||
// Step 7. We create a JMS Connection connection0 which is a connection to server 0
|
||||
|
||||
|
|
|
@ -1,19 +1,8 @@
|
|||
<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="netty-connector"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="ConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory>
|
||||
|
||||
<!--the queue used by the example-->
|
||||
<queue name="sausage-factory">
|
||||
<entry name="/queue/sausage-factory"/>
|
||||
</queue>
|
||||
<queue name="sausage-factory"/>
|
||||
|
||||
</configuration>
|
|
@ -1,19 +1,8 @@
|
|||
<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="netty-connector"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="ConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory>
|
||||
|
||||
<!--the queue used by the example-->
|
||||
<queue name="mincing-machine">
|
||||
<entry name="/queue/mincing-machine"/>
|
||||
</queue>
|
||||
<queue name="mincing-machine"/>
|
||||
|
||||
</configuration>
|
|
@ -44,7 +44,7 @@
|
|||
<configuration>
|
||||
<clientClass>org.apache.activemq.jms.example.QueueBrowserExample</clientClass>
|
||||
<args>
|
||||
<param>jnp://localhost:1099</param>
|
||||
<param>tcp://localhost:5445</param>
|
||||
</args>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
@ -91,11 +91,6 @@
|
|||
<artifactId>jboss-jms-api</artifactId>
|
||||
<version>1.1.0.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.naming</groupId>
|
||||
<artifactId>jnpserver</artifactId>
|
||||
<version>5.0.3.GA</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<waitOnStart>false</waitOnStart>
|
||||
|
|
|
@ -55,10 +55,10 @@ public class QueueBrowserExample extends ActiveMQExample
|
|||
initialContext = getContext(0);
|
||||
|
||||
// Step 2. Perfom a lookup on the queue
|
||||
Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue");
|
||||
Queue queue = (Queue)initialContext.lookup("queue/exampleQueue");
|
||||
|
||||
// Step 3. Perform a lookup on the Connection Factory
|
||||
ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");
|
||||
ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory");
|
||||
|
||||
// Step 4. Create a JMS Connection
|
||||
connection = cf.createConnection();
|
||||
|
|
|
@ -1,19 +1,8 @@
|
|||
<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="netty-connector"/>
|
||||
</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>
|
|
@ -75,7 +75,7 @@
|
|||
<configuration>
|
||||
<clientClass>org.apache.activemq.jms.example.ClientKickoffExample</clientClass>
|
||||
<args>
|
||||
<param>jnp://localhost:1099</param>
|
||||
<param>tcp://localhost:5445</param>
|
||||
</args>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
@ -122,11 +122,6 @@
|
|||
<artifactId>jboss-jms-api</artifactId>
|
||||
<version>1.1.0.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.naming</groupId>
|
||||
<artifactId>jnpserver</artifactId>
|
||||
<version>5.0.3.GA</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<waitOnStart>false</waitOnStart>
|
||||
|
|
|
@ -60,7 +60,7 @@ public class ClientKickoffExample extends ActiveMQExample
|
|||
initialContext = getContext(0);
|
||||
|
||||
// Step 2. Perform a lookup on the Connection Factory
|
||||
QueueConnectionFactory cf = (QueueConnectionFactory)initialContext.lookup("/ConnectionFactory");
|
||||
QueueConnectionFactory cf = (QueueConnectionFactory)initialContext.lookup("ConnectionFactory");
|
||||
|
||||
// Step 3.Create a JMS Connection
|
||||
connection = cf.createQueueConnection();
|
||||
|
|
|
@ -1,14 +1,5 @@
|
|||
<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" signature="queue">
|
||||
<connectors>
|
||||
<connector-ref connector-name="netty"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="ConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory>
|
||||
|
||||
</configuration>
|
||||
|
|
|
@ -80,8 +80,8 @@
|
|||
<configuration>
|
||||
<clientClass>org.apache.activemq.jms.example.ClientSideFailoverListerExample</clientClass>
|
||||
<args>
|
||||
<param>jnp://localhost:1099</param>
|
||||
<param>jnp://localhost:1199</param>
|
||||
<param>tcp://localhost:5445</param>
|
||||
<param>tcp://localhost:5446</param>
|
||||
</args>
|
||||
<systemProperties>
|
||||
<property>
|
||||
|
@ -146,11 +146,6 @@
|
|||
<artifactId>jboss-jms-api</artifactId>
|
||||
<version>1.1.0.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.naming</groupId>
|
||||
<artifactId>jnpserver</artifactId>
|
||||
<version>5.0.3.GA</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<waitOnStart>false</waitOnStart>
|
||||
|
|
|
@ -58,10 +58,10 @@ public class ClientSideFailoverListerExample extends ActiveMQExample
|
|||
initialContext = getContext(0);
|
||||
|
||||
// Step 2. Look-up the JMS Queue object from JNDI
|
||||
Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue");
|
||||
Queue queue = (Queue)initialContext.lookup("queue/exampleQueue");
|
||||
|
||||
// Step 3. Look-up a JMS Connection Factory object from JNDI on server 0
|
||||
ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");
|
||||
ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("ConnectionFactory");
|
||||
|
||||
// Step 4. We create 1 JMS connections from the same connection factory.
|
||||
// Wait a little while to make sure broadcasts from all nodes have reached the client
|
||||
|
|
|
@ -1,33 +1,8 @@
|
|||
<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="netty-connector"/>
|
||||
</connectors>
|
||||
|
||||
<entries>
|
||||
<entry name="ConnectionFactory"/>
|
||||
</entries>
|
||||
|
||||
<ha>true</ha>
|
||||
<!-- Pause 1 second between connect attempts -->
|
||||
<retry-interval>1000</retry-interval>
|
||||
|
||||
<!-- Multiply subsequent reconnect pauses by this multiplier. This can be used to
|
||||
implement an exponential back-off. For our purposes we just set to 1.0 so each reconnect
|
||||
pause is the same length -->
|
||||
<retry-interval-multiplier>1.0</retry-interval-multiplier>
|
||||
|
||||
<!-- Try reconnecting an unlimited number of times (-1 means "unlimited") -->
|
||||
<reconnect-attempts>-1</reconnect-attempts>
|
||||
|
||||
</connection-factory>
|
||||
|
||||
<!--the queue used by the example-->
|
||||
<queue name="exampleQueue">
|
||||
<entry name="/queue/exampleQueue"/>
|
||||
</queue>
|
||||
<queue name="exampleQueue"/>
|
||||
|
||||
</configuration>
|
||||
|
|
|
@ -1,32 +1,8 @@
|
|||
<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="netty-connector"/>
|
||||
</connectors>
|
||||
|
||||
<entries>
|
||||
<entry name="ConnectionFactory"/>
|
||||
</entries>
|
||||
|
||||
<ha>true</ha>
|
||||
<!-- Pause 1 second between connect attempts -->
|
||||
<retry-interval>1000</retry-interval>
|
||||
|
||||
<!-- Multiply subsequent reconnect pauses by this multiplier. This can be used to
|
||||
implement an exponential back-off. For our purposes we just set to 1.0 so each reconnect
|
||||
pause is the same length -->
|
||||
<retry-interval-multiplier>1.0</retry-interval-multiplier>
|
||||
|
||||
<!-- Try reconnecting an unlimited number of times (-1 means "unlimited") -->
|
||||
<reconnect-attempts>-1</reconnect-attempts>
|
||||
</connection-factory>
|
||||
|
||||
<!--the queue used by the example-->
|
||||
<queue name="exampleQueue">
|
||||
<entry name="/queue/exampleQueue"/>
|
||||
</queue>
|
||||
<queue name="exampleQueue"/>
|
||||
|
||||
</configuration>
|
||||
|
|
|
@ -101,8 +101,8 @@
|
|||
<configuration>
|
||||
<clientClass>org.apache.activemq.jms.example.ClientSideLoadBalancingExample</clientClass>
|
||||
<args>
|
||||
<param>jnp://localhost:1099</param>
|
||||
<param>jnp://localhost:1199</param>
|
||||
<param>tcp://localhost:5445</param>
|
||||
<param>tcp://localhost:5446</param>
|
||||
</args>
|
||||
<systemProperties>
|
||||
<property>
|
||||
|
@ -176,11 +176,6 @@
|
|||
<artifactId>jboss-jms-api</artifactId>
|
||||
<version>1.1.0.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.naming</groupId>
|
||||
<artifactId>jnpserver</artifactId>
|
||||
<version>5.0.3.GA</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<waitOnStart>false</waitOnStart>
|
||||
|
|
|
@ -59,10 +59,10 @@ public class ClientSideLoadBalancingExample extends ActiveMQExample
|
|||
initialContext = getContext(0);
|
||||
|
||||
// Step 2. Look-up the JMS Queue object from JNDI
|
||||
Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue");
|
||||
Queue queue = (Queue)initialContext.lookup("queue/exampleQueue");
|
||||
|
||||
// Step 3. Look-up a JMS Connection Factory object from JNDI on server 0
|
||||
ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");
|
||||
ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("ConnectionFactory");
|
||||
|
||||
// Step 4. We create 3 JMS connections from the same connection factory. Since we are using round-robin
|
||||
// load-balancing this should result in each sessions being connected to a different node of the cluster
|
||||
|
|
|
@ -1,17 +1,8 @@
|
|||
<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">
|
||||
<discovery-group-ref discovery-group-name="my-discovery-group"/>
|
||||
<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>
|
|
@ -1,17 +1,8 @@
|
|||
<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">
|
||||
<discovery-group-ref discovery-group-name="my-discovery-group"/>
|
||||
<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>
|
|
@ -1,17 +1,8 @@
|
|||
<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">
|
||||
<discovery-group-ref discovery-group-name="my-discovery-group"/>
|
||||
<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>
|
|
@ -79,8 +79,8 @@
|
|||
<configuration>
|
||||
<clientClass>org.apache.activemq.jms.example.ClusteredDurableSubscriptionExample</clientClass>
|
||||
<args>
|
||||
<param>jnp://localhost:1099</param>
|
||||
<param>jnp://localhost:1199</param>
|
||||
<param>tcp://localhost:5445</param>
|
||||
<param>tcp://localhost:5446</param>
|
||||
</args>
|
||||
<systemProperties>
|
||||
<property>
|
||||
|
@ -145,11 +145,6 @@
|
|||
<artifactId>jboss-jms-api</artifactId>
|
||||
<version>1.1.0.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.naming</groupId>
|
||||
<artifactId>jnpserver</artifactId>
|
||||
<version>5.0.3.GA</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<waitOnStart>false</waitOnStart>
|
||||
|
|
|
@ -59,16 +59,16 @@ public class ClusteredDurableSubscriptionExample extends ActiveMQExample
|
|||
ic0 = getContext(0);
|
||||
|
||||
// Step 2. Look-up the JMS Topic object from JNDI
|
||||
Topic topic = (Topic)ic0.lookup("/topic/exampleTopic");
|
||||
Topic topic = (Topic)ic0.lookup("topic/exampleTopic");
|
||||
|
||||
// Step 3. Look-up a JMS Connection Factory object from JNDI on server 0
|
||||
ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("/ConnectionFactory");
|
||||
ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("ConnectionFactory");
|
||||
|
||||
// Step 4. Get an initial context for looking up JNDI from server 1
|
||||
ic1 = getContext(1);
|
||||
|
||||
// Step 5. Look-up a JMS Connection Factory object from JNDI on server 1
|
||||
ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("/ConnectionFactory");
|
||||
ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("ConnectionFactory");
|
||||
|
||||
// Step 6. We create a JMS Connection connection0 which is a connection to server 0
|
||||
// and set the client-id
|
||||
|
|
|
@ -1,19 +1,8 @@
|
|||
<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="netty-connector"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="ConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory>
|
||||
|
||||
<!--the topic used by the example-->
|
||||
<topic name="exampleTopic">
|
||||
<entry name="/topic/exampleTopic"/>
|
||||
</topic>
|
||||
<topic name="exampleTopic"/>
|
||||
|
||||
</configuration>
|
|
@ -1,19 +1,8 @@
|
|||
<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="netty-connector"/>
|
||||
</connectors>
|
||||
<entries>
|
||||
<entry name="ConnectionFactory"/>
|
||||
</entries>
|
||||
</connection-factory>
|
||||
|
||||
<!--the topic used by the example-->
|
||||
<topic name="exampleTopic">
|
||||
<entry name="/topic/exampleTopic"/>
|
||||
</topic>
|
||||
<topic name="exampleTopic"/>
|
||||
|
||||
</configuration>
|
|
@ -101,9 +101,9 @@
|
|||
<configuration>
|
||||
<clientClass>org.apache.activemq.jms.example.ClusteredGroupingExample</clientClass>
|
||||
<args>
|
||||
<param>jnp://localhost:1099</param>
|
||||
<param>jnp://localhost:1199</param>
|
||||
<param>jnp://localhost:1299</param>
|
||||
<param>tcp://localhost:5445</param>
|
||||
<param>tcp://localhost:5446</param>
|
||||
<param>tcp://localhost:5447</param>
|
||||
</args>
|
||||
<systemProperties>
|
||||
<property>
|
||||
|
@ -177,11 +177,6 @@
|
|||
<artifactId>jboss-jms-api</artifactId>
|
||||
<version>1.1.0.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.naming</groupId>
|
||||
<artifactId>jnpserver</artifactId>
|
||||
<version>5.0.3.GA</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<waitOnStart>false</waitOnStart>
|
||||
|
|
|
@ -61,22 +61,22 @@ public class ClusteredGroupingExample extends ActiveMQExample
|
|||
ic0 = getContext(0);
|
||||
|
||||
// Step 2. Look-up the JMS Queue object from JNDI
|
||||
Queue queue = (Queue)ic0.lookup("/queue/exampleQueue");
|
||||
Queue queue = (Queue)ic0.lookup("queue/exampleQueue");
|
||||
|
||||
// Step 3. Look-up a JMS Connection Factory object from JNDI on server 0
|
||||
ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("/ConnectionFactory");
|
||||
ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("ConnectionFactory");
|
||||
|
||||
// Step 4. Get an initial context for looking up JNDI from server 1
|
||||
ic1 = getContext(1);
|
||||
|
||||
// Step 5. Look-up a JMS Connection Factory object from JNDI on server 1
|
||||
ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("/ConnectionFactory");
|
||||
ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("ConnectionFactory");
|
||||
|
||||
// Step 4. Get an initial context for looking up JNDI from server 1
|
||||
ic2 = getContext(2);
|
||||
|
||||
// Step 5. Look-up a JMS Connection Factory object from JNDI on server 1
|
||||
ConnectionFactory cf2 = (ConnectionFactory)ic2.lookup("/ConnectionFactory");
|
||||
ConnectionFactory cf2 = (ConnectionFactory)ic2.lookup("ConnectionFactory");
|
||||
|
||||
// Step 6. We create a JMS Connection connection0 which is a connection to server 0
|
||||
connection0 = cf0.createConnection();
|
||||
|
|
|
@ -1,19 +1,8 @@
|
|||
<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="netty-connector"/>
|
||||
</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>
|
|
@ -1,19 +1,8 @@
|
|||
<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="netty-connector"/>
|
||||
</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>
|
|
@ -1,19 +1,8 @@
|
|||
<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="netty-connector"/>
|
||||
</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>
|
|
@ -75,8 +75,8 @@
|
|||
<configuration>
|
||||
<clientClass>org.apache.activemq.jms.example.ClusteredJgroupsExample</clientClass>
|
||||
<args>
|
||||
<param>jnp://localhost:1099</param>
|
||||
<param>jnp://localhost:1199</param>
|
||||
<param>tcp://localhost:5445</param>
|
||||
<param>tcp://localhost:5446</param>
|
||||
</args>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
@ -135,11 +135,6 @@
|
|||
<artifactId>jboss-jms-api</artifactId>
|
||||
<version>1.1.0.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.naming</groupId>
|
||||
<artifactId>jnpserver</artifactId>
|
||||
<version>5.0.3.GA</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<waitOnStart>false</waitOnStart>
|
||||
|
|
|
@ -57,16 +57,16 @@ public class ClusteredJgroupsExample extends ActiveMQExample
|
|||
ic0 = getContext(0);
|
||||
|
||||
// Step 2. Look-up the JMS Queue object from JNDI
|
||||
Queue queue = (Queue)ic0.lookup("/queue/exampleQueue");
|
||||
Queue queue = (Queue)ic0.lookup("queue/exampleQueue");
|
||||
|
||||
// Step 3. Look-up a JMS Connection Factory object from JNDI on server 0
|
||||
ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("/ConnectionFactory");
|
||||
ConnectionFactory cf0 = (ConnectionFactory)ic0.lookup("ConnectionFactory");
|
||||
|
||||
// Step 4. Get an initial context for looking up JNDI from server 1
|
||||
ic1 = getContext(1);
|
||||
|
||||
// Step 5. Look-up a JMS Connection Factory object from JNDI on server 1
|
||||
ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("/ConnectionFactory");
|
||||
ConnectionFactory cf1 = (ConnectionFactory)ic1.lookup("ConnectionFactory");
|
||||
|
||||
// Step 6. We create a JMS Connection connection0 which is a connection to server 0
|
||||
connection0 = cf0.createConnection();
|
||||
|
|
|
@ -1,19 +1,8 @@
|
|||
<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="netty-connector"/>
|
||||
</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>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue