activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmipba <jmipa2004-trab...@yahoo.es>
Subject ActiveMQWASInitialContextFactory return SingleConnectionFactory
Date Mon, 15 Feb 2016 15:44:20 GMT
We have created a new implementation of the ActiveMQ WAS
InitialContextFactory class.
This implementation uses internally Spring SingleConnectionFactory
(org.springframework.jms.connection.SingleConnectionFactory).

The goal is to share the same connection between all applications of an
instance.

The test went well, but we do not see references to do the same.

There is a problem we do not know?

	public Context getSingleInitialContext(Hashtable environment) throws
NamingException {
		Map<String, Object> data = new ConcurrentHashMap();
		String[] names = getConnectionFactoryNames(environment);
		for (int i = 0; i < names.length; i++) {
			SingleConnectionFactory factory = null;
			String name = names[i];
			try {
				ActiveMQConnectionFactory activeMQFactory =
createConnectionFactory(name, environment);;
				factory = new SingleConnectionFactory(activeMQFactory);
				factory.setReconnectOnException(true);
			} catch (Exception e) {
				throw new NamingException("Invalid broker URL");
			}
			data.put(name, factory);
		}
		createQueues(data, environment);
		createTopics(data, environment);

		data.put("dynamicQueues", new LazyCreateContext() {
			private static final long serialVersionUID = 6503881346214855588L;

			protected Object createEntry(String name) {
				return new ActiveMQQueue(name);
			}
		});
		data.put("dynamicTopics", new LazyCreateContext() {
			private static final long serialVersionUID = 2019166796234979615L;

			protected Object createEntry(String name) {
				return new ActiveMQTopic(name);
			}
		});
		return createContext(environment, data);
	}




--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQWASInitialContextFactory-return-SingleConnectionFactory-tp4707506.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Mime
View raw message