36 changed files with 27 additions and 1938 deletions
@ -1,58 +0,0 @@
@@ -1,58 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2016 the original author or authors. |
||||
* |
||||
* Licensed 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.springframework.boot.autoconfigure.jms.hornetq; |
||||
|
||||
import javax.jms.ConnectionFactory; |
||||
|
||||
import org.hornetq.api.jms.HornetQJMSClient; |
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter; |
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore; |
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; |
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; |
||||
import org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration; |
||||
import org.springframework.boot.autoconfigure.jms.JndiConnectionFactoryAutoConfiguration; |
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.context.annotation.Import; |
||||
|
||||
/** |
||||
* {@link EnableAutoConfiguration Auto-configuration} to integrate with an HornetQ broker. |
||||
* If the necessary classes are present, embed the broker in the application by default. |
||||
* Otherwise, connect to a broker available on the local machine with the default |
||||
* settings. |
||||
* |
||||
* @author Stephane Nicoll |
||||
* @author Phillip Webb |
||||
* @since 1.1.0 |
||||
* @see HornetQProperties |
||||
* @deprecated as of 1.4 in favor of the Artemis support |
||||
*/ |
||||
@Configuration |
||||
@AutoConfigureBefore(JmsAutoConfiguration.class) |
||||
@AutoConfigureAfter({ JndiConnectionFactoryAutoConfiguration.class }) |
||||
@ConditionalOnClass({ ConnectionFactory.class, HornetQJMSClient.class }) |
||||
@ConditionalOnMissingBean(ConnectionFactory.class) |
||||
@EnableConfigurationProperties(HornetQProperties.class) |
||||
@Import({ HornetQEmbeddedServerConfiguration.class, |
||||
HornetQXAConnectionFactoryConfiguration.class, |
||||
HornetQConnectionFactoryConfiguration.class }) |
||||
@Deprecated |
||||
public class HornetQAutoConfiguration { |
||||
|
||||
} |
||||
@ -1,41 +0,0 @@
@@ -1,41 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2016 the original author or authors. |
||||
* |
||||
* Licensed 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.springframework.boot.autoconfigure.jms.hornetq; |
||||
|
||||
import org.hornetq.core.config.Configuration; |
||||
import org.hornetq.jms.server.embedded.EmbeddedJMS; |
||||
|
||||
/** |
||||
* Callback interface that can be implemented by beans wishing to customize the HornetQ |
||||
* JMS server {@link Configuration} before it is used by an auto-configured |
||||
* {@link EmbeddedJMS} instance. |
||||
* |
||||
* @author Phillip Webb |
||||
* @since 1.1.0 |
||||
* @see HornetQAutoConfiguration |
||||
* @deprecated as of 1.4 in favor of the Artemis support |
||||
*/ |
||||
@Deprecated |
||||
public interface HornetQConfigurationCustomizer { |
||||
|
||||
/** |
||||
* Customize the configuration. |
||||
* @param configuration the configuration to customize |
||||
*/ |
||||
void customize(Configuration configuration); |
||||
|
||||
} |
||||
@ -1,47 +0,0 @@
@@ -1,47 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2016 the original author or authors. |
||||
* |
||||
* Licensed 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.springframework.boot.autoconfigure.jms.hornetq; |
||||
|
||||
import javax.jms.ConnectionFactory; |
||||
|
||||
import org.hornetq.jms.client.HornetQConnectionFactory; |
||||
|
||||
import org.springframework.beans.factory.ListableBeanFactory; |
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
|
||||
/** |
||||
* Configuration for HornetQ {@link ConnectionFactory}. |
||||
* |
||||
* @author Phillip Webb |
||||
* @since 1.2.0 |
||||
* @deprecated as of 1.4 in favor of the Artemis support |
||||
*/ |
||||
@Configuration |
||||
@ConditionalOnMissingBean(ConnectionFactory.class) |
||||
@Deprecated |
||||
class HornetQConnectionFactoryConfiguration { |
||||
|
||||
@Bean |
||||
public HornetQConnectionFactory jmsConnectionFactory(ListableBeanFactory beanFactory, |
||||
HornetQProperties properties) { |
||||
return new HornetQConnectionFactoryFactory(beanFactory, properties) |
||||
.createConnectionFactory(SpringBootHornetQConnectionFactory.class); |
||||
} |
||||
|
||||
} |
||||
@ -1,142 +0,0 @@
@@ -1,142 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2016 the original author or authors. |
||||
* |
||||
* Licensed 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.springframework.boot.autoconfigure.jms.hornetq; |
||||
|
||||
import java.lang.reflect.Constructor; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
import org.hornetq.api.core.TransportConfiguration; |
||||
import org.hornetq.api.core.client.HornetQClient; |
||||
import org.hornetq.api.core.client.ServerLocator; |
||||
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory; |
||||
import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory; |
||||
import org.hornetq.core.remoting.impl.netty.TransportConstants; |
||||
import org.hornetq.jms.client.HornetQConnectionFactory; |
||||
|
||||
import org.springframework.beans.BeanUtils; |
||||
import org.springframework.beans.factory.ListableBeanFactory; |
||||
import org.springframework.util.Assert; |
||||
import org.springframework.util.ClassUtils; |
||||
|
||||
/** |
||||
* Factory to create a {@link HornetQConnectionFactory} instance from properties defined |
||||
* in {@link HornetQProperties}. |
||||
* |
||||
* @author Phillip Webb |
||||
* @author Stephane Nicoll |
||||
* @since 1.2.0 |
||||
* @deprecated as of 1.4 in favor of the Artemis support |
||||
*/ |
||||
@Deprecated |
||||
class HornetQConnectionFactoryFactory { |
||||
|
||||
static final String EMBEDDED_JMS_CLASS = "org.hornetq.jms.server.embedded.EmbeddedJMS"; |
||||
|
||||
private final HornetQProperties properties; |
||||
|
||||
private final ListableBeanFactory beanFactory; |
||||
|
||||
HornetQConnectionFactoryFactory(ListableBeanFactory beanFactory, |
||||
HornetQProperties properties) { |
||||
Assert.notNull(beanFactory, "BeanFactory must not be null"); |
||||
Assert.notNull(properties, "Properties must not be null"); |
||||
this.beanFactory = beanFactory; |
||||
this.properties = properties; |
||||
} |
||||
|
||||
public <T extends HornetQConnectionFactory> T createConnectionFactory( |
||||
Class<T> factoryClass) { |
||||
try { |
||||
startEmbeddedJms(); |
||||
return doCreateConnectionFactory(factoryClass); |
||||
} |
||||
catch (Exception ex) { |
||||
throw new IllegalStateException( |
||||
"Unable to create " + "HornetQConnectionFactory", ex); |
||||
} |
||||
} |
||||
|
||||
private void startEmbeddedJms() { |
||||
if (ClassUtils.isPresent(EMBEDDED_JMS_CLASS, null)) { |
||||
try { |
||||
this.beanFactory.getBeansOfType(Class.forName(EMBEDDED_JMS_CLASS)); |
||||
} |
||||
catch (Exception ex) { |
||||
// Ignore
|
||||
} |
||||
} |
||||
} |
||||
|
||||
private <T extends HornetQConnectionFactory> T doCreateConnectionFactory( |
||||
Class<T> factoryClass) throws Exception { |
||||
HornetQMode mode = this.properties.getMode(); |
||||
if (mode == null) { |
||||
mode = deduceMode(); |
||||
} |
||||
if (mode == HornetQMode.EMBEDDED) { |
||||
return createEmbeddedConnectionFactory(factoryClass); |
||||
} |
||||
return createNativeConnectionFactory(factoryClass); |
||||
} |
||||
|
||||
/** |
||||
* Deduce the {@link HornetQMode} to use if none has been set. |
||||
* @return the mode |
||||
*/ |
||||
private HornetQMode deduceMode() { |
||||
if (this.properties.getEmbedded().isEnabled() |
||||
&& ClassUtils.isPresent(EMBEDDED_JMS_CLASS, null)) { |
||||
return HornetQMode.EMBEDDED; |
||||
} |
||||
return HornetQMode.NATIVE; |
||||
} |
||||
|
||||
private <T extends HornetQConnectionFactory> T createEmbeddedConnectionFactory( |
||||
Class<T> factoryClass) throws Exception { |
||||
try { |
||||
TransportConfiguration transportConfiguration = new TransportConfiguration( |
||||
InVMConnectorFactory.class.getName(), |
||||
this.properties.getEmbedded().generateTransportParameters()); |
||||
ServerLocator serviceLocator = HornetQClient |
||||
.createServerLocatorWithoutHA(transportConfiguration); |
||||
Constructor<T> constructor = factoryClass |
||||
.getDeclaredConstructor(HornetQProperties.class, ServerLocator.class); |
||||
return BeanUtils.instantiateClass(constructor, this.properties, |
||||
serviceLocator); |
||||
} |
||||
catch (NoClassDefFoundError ex) { |
||||
throw new IllegalStateException("Unable to create InVM " |
||||
+ "HornetQ connection, ensure that hornet-jms-server.jar " |
||||
+ "is in the classpath", ex); |
||||
} |
||||
} |
||||
|
||||
private <T extends HornetQConnectionFactory> T createNativeConnectionFactory( |
||||
Class<T> factoryClass) throws Exception { |
||||
Map<String, Object> params = new HashMap<String, Object>(); |
||||
params.put(TransportConstants.HOST_PROP_NAME, this.properties.getHost()); |
||||
params.put(TransportConstants.PORT_PROP_NAME, this.properties.getPort()); |
||||
TransportConfiguration transportConfiguration = new TransportConfiguration( |
||||
NettyConnectorFactory.class.getName(), params); |
||||
Constructor<T> constructor = factoryClass.getDeclaredConstructor( |
||||
HornetQProperties.class, boolean.class, TransportConfiguration[].class); |
||||
return BeanUtils.instantiateClass(constructor, this.properties, false, |
||||
new TransportConfiguration[] { transportConfiguration }); |
||||
} |
||||
|
||||
} |
||||
@ -1,90 +0,0 @@
@@ -1,90 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2016 the original author or authors. |
||||
* |
||||
* Licensed 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.springframework.boot.autoconfigure.jms.hornetq; |
||||
|
||||
import java.io.File; |
||||
|
||||
import org.apache.commons.logging.Log; |
||||
import org.apache.commons.logging.LogFactory; |
||||
import org.hornetq.api.core.TransportConfiguration; |
||||
import org.hornetq.core.config.Configuration; |
||||
import org.hornetq.core.config.impl.ConfigurationImpl; |
||||
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory; |
||||
import org.hornetq.core.server.JournalType; |
||||
|
||||
import org.springframework.boot.autoconfigure.jms.hornetq.HornetQProperties.Embedded; |
||||
|
||||
/** |
||||
* Factory class to create a HornetQ {@link Configuration} from {@link HornetQProperties}. |
||||
* |
||||
* @author Stephane Nicoll |
||||
* @author Phillip Webb |
||||
* @since 1.1.0 |
||||
* @deprecated as of 1.4 in favor of the Artemis support |
||||
*/ |
||||
@Deprecated |
||||
class HornetQEmbeddedConfigurationFactory { |
||||
|
||||
private static final Log logger = LogFactory |
||||
.getLog(HornetQEmbeddedConfigurationFactory.class); |
||||
|
||||
private final Embedded properties; |
||||
|
||||
HornetQEmbeddedConfigurationFactory(HornetQProperties properties) { |
||||
this.properties = properties.getEmbedded(); |
||||
} |
||||
|
||||
public Configuration createConfiguration() { |
||||
ConfigurationImpl configuration = new ConfigurationImpl(); |
||||
configuration.setSecurityEnabled(false); |
||||
configuration.setPersistenceEnabled(this.properties.isPersistent()); |
||||
|
||||
String dataDir = getDataDir(); |
||||
|
||||
// HORNETQ-1302
|
||||
configuration.setJournalDirectory(dataDir + "/journal"); |
||||
|
||||
if (this.properties.isPersistent()) { |
||||
configuration.setJournalType(JournalType.NIO); |
||||
configuration.setLargeMessagesDirectory(dataDir + "/largemessages"); |
||||
configuration.setBindingsDirectory(dataDir + "/bindings"); |
||||
configuration.setPagingDirectory(dataDir + "/paging"); |
||||
} |
||||
|
||||
TransportConfiguration transportConfiguration = new TransportConfiguration( |
||||
InVMAcceptorFactory.class.getName(), |
||||
this.properties.generateTransportParameters()); |
||||
configuration.getAcceptorConfigurations().add(transportConfiguration); |
||||
|
||||
// HORNETQ-1143
|
||||
if (this.properties.isDefaultClusterPassword()) { |
||||
logger.debug("Using default HornetQ cluster password: " |
||||
+ this.properties.getClusterPassword()); |
||||
} |
||||
|
||||
configuration.setClusterPassword(this.properties.getClusterPassword()); |
||||
return configuration; |
||||
} |
||||
|
||||
private String getDataDir() { |
||||
if (this.properties.getDataDirectory() != null) { |
||||
return this.properties.getDataDirectory(); |
||||
} |
||||
String tempDirectory = System.getProperty("java.io.tmpdir"); |
||||
return new File(tempDirectory, "hornetq-data").getAbsolutePath(); |
||||
} |
||||
} |
||||
@ -1,130 +0,0 @@
@@ -1,130 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2016 the original author or authors. |
||||
* |
||||
* Licensed 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.springframework.boot.autoconfigure.jms.hornetq; |
||||
|
||||
import java.util.Collection; |
||||
import java.util.List; |
||||
|
||||
import org.hornetq.jms.server.config.JMSConfiguration; |
||||
import org.hornetq.jms.server.config.JMSQueueConfiguration; |
||||
import org.hornetq.jms.server.config.TopicConfiguration; |
||||
import org.hornetq.jms.server.config.impl.JMSConfigurationImpl; |
||||
import org.hornetq.jms.server.config.impl.JMSQueueConfigurationImpl; |
||||
import org.hornetq.jms.server.config.impl.TopicConfigurationImpl; |
||||
import org.hornetq.jms.server.embedded.EmbeddedJMS; |
||||
|
||||
import org.springframework.beans.factory.ObjectProvider; |
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; |
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.core.annotation.AnnotationAwareOrderComparator; |
||||
|
||||
/** |
||||
* Configuration used to create the embedded HornetQ server. |
||||
* |
||||
* @author Phillip Webb |
||||
* @author Stephane Nicoll |
||||
* @since 1.2.0 |
||||
* @deprecated as of 1.4 in favor of the Artemis support |
||||
*/ |
||||
@Configuration |
||||
@ConditionalOnClass(name = HornetQConnectionFactoryFactory.EMBEDDED_JMS_CLASS) |
||||
@ConditionalOnProperty(prefix = "spring.hornetq.embedded", name = "enabled", havingValue = "true", matchIfMissing = true) |
||||
@Deprecated |
||||
class HornetQEmbeddedServerConfiguration { |
||||
|
||||
private final HornetQProperties properties; |
||||
|
||||
private final List<HornetQConfigurationCustomizer> configurationCustomizers; |
||||
|
||||
private final List<JMSQueueConfiguration> queuesConfiguration; |
||||
|
||||
private final List<TopicConfiguration> topicsConfiguration; |
||||
|
||||
HornetQEmbeddedServerConfiguration(HornetQProperties properties, |
||||
ObjectProvider<List<HornetQConfigurationCustomizer>> configurationCustomizersProvider, |
||||
ObjectProvider<List<JMSQueueConfiguration>> queuesConfigurationProvider, |
||||
ObjectProvider<List<TopicConfiguration>> topicsConfigurationProvider) { |
||||
this.properties = properties; |
||||
this.configurationCustomizers = configurationCustomizersProvider.getIfAvailable(); |
||||
this.queuesConfiguration = queuesConfigurationProvider.getIfAvailable(); |
||||
this.topicsConfiguration = topicsConfigurationProvider.getIfAvailable(); |
||||
} |
||||
|
||||
@Bean |
||||
@ConditionalOnMissingBean |
||||
public org.hornetq.core.config.Configuration hornetQConfiguration() { |
||||
return new HornetQEmbeddedConfigurationFactory(this.properties) |
||||
.createConfiguration(); |
||||
} |
||||
|
||||
@Bean(initMethod = "start", destroyMethod = "stop") |
||||
@ConditionalOnMissingBean |
||||
public EmbeddedJMS hornetQServer(org.hornetq.core.config.Configuration configuration, |
||||
JMSConfiguration jmsConfiguration) { |
||||
EmbeddedJMS server = new EmbeddedJMS(); |
||||
customize(configuration); |
||||
server.setConfiguration(configuration); |
||||
server.setJmsConfiguration(jmsConfiguration); |
||||
server.setRegistry(new HornetQNoOpBindingRegistry()); |
||||
return server; |
||||
} |
||||
|
||||
private void customize(org.hornetq.core.config.Configuration configuration) { |
||||
if (this.configurationCustomizers != null) { |
||||
AnnotationAwareOrderComparator.sort(this.configurationCustomizers); |
||||
for (HornetQConfigurationCustomizer customizer : this.configurationCustomizers) { |
||||
customizer.customize(configuration); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Bean |
||||
@ConditionalOnMissingBean |
||||
public JMSConfiguration hornetQJmsConfiguration() { |
||||
JMSConfiguration configuration = new JMSConfigurationImpl(); |
||||
addAll(configuration.getQueueConfigurations(), this.queuesConfiguration); |
||||
addAll(configuration.getTopicConfigurations(), this.topicsConfiguration); |
||||
addQueues(configuration, this.properties.getEmbedded().getQueues()); |
||||
addTopics(configuration, this.properties.getEmbedded().getTopics()); |
||||
return configuration; |
||||
} |
||||
|
||||
private <T> void addAll(List<T> list, Collection<? extends T> items) { |
||||
if (items != null) { |
||||
list.addAll(items); |
||||
} |
||||
} |
||||
|
||||
private void addQueues(JMSConfiguration configuration, String[] queues) { |
||||
boolean persistent = this.properties.getEmbedded().isPersistent(); |
||||
for (String queue : queues) { |
||||
configuration.getQueueConfigurations().add(new JMSQueueConfigurationImpl( |
||||
queue, null, persistent, "/queue/" + queue)); |
||||
} |
||||
} |
||||
|
||||
private void addTopics(JMSConfiguration configuration, String[] topics) { |
||||
for (String topic : topics) { |
||||
configuration.getTopicConfigurations() |
||||
.add(new TopicConfigurationImpl(topic, "/topic/" + topic)); |
||||
} |
||||
} |
||||
|
||||
} |
||||
@ -1,39 +0,0 @@
@@ -1,39 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2016 the original author or authors. |
||||
* |
||||
* Licensed 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.springframework.boot.autoconfigure.jms.hornetq; |
||||
|
||||
/** |
||||
* Define the mode in which HornetQ can operate. |
||||
* |
||||
* @author Stephane Nicoll |
||||
* @since 1.1.0 |
||||
* @deprecated as of 1.4 in favor of the Artemis support |
||||
*/ |
||||
@Deprecated |
||||
public enum HornetQMode { |
||||
|
||||
/** |
||||
* Connect to a broker using the native HornetQ protocol (i.e. netty). |
||||
*/ |
||||
NATIVE, |
||||
|
||||
/** |
||||
* Embed (i.e. start) the broker in the application. |
||||
*/ |
||||
EMBEDDED |
||||
|
||||
} |
||||
@ -1,66 +0,0 @@
@@ -1,66 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2016 the original author or authors. |
||||
* |
||||
* Licensed 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.springframework.boot.autoconfigure.jms.hornetq; |
||||
|
||||
import org.hornetq.spi.core.naming.BindingRegistry; |
||||
|
||||
/** |
||||
* A no-op implementation of the {@link org.hornetq.spi.core.naming.BindingRegistry}. |
||||
* |
||||
* @author Stephane Nicoll |
||||
* @since 1.1.0 |
||||
* @deprecated as of 1.4 in favor of the Artemis support |
||||
*/ |
||||
@Deprecated |
||||
public class HornetQNoOpBindingRegistry implements BindingRegistry { |
||||
|
||||
@Override |
||||
public Object lookup(String name) { |
||||
// This callback is used to check if an entry is present in the context before
|
||||
// creating a queue on the fly. This is actually never used to try to fetch a
|
||||
// destination that is unknown.
|
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public boolean bind(String name, Object obj) { |
||||
// This callback is used bind a Destination created on the fly by the embedded
|
||||
// broker using the JNDI name that was specified in the configuration. This does
|
||||
// not look very useful since it's used nowhere. It could be interesting to
|
||||
// autowire a destination to use it but the wiring is a bit "asynchronous" so
|
||||
// better not provide that feature at all.
|
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public void unbind(String name) { |
||||
} |
||||
|
||||
@Override |
||||
public void close() { |
||||
} |
||||
|
||||
@Override |
||||
public Object getContext() { |
||||
return this; |
||||
} |
||||
|
||||
@Override |
||||
public void setContext(Object ctx) { |
||||
} |
||||
|
||||
} |
||||
@ -1,230 +0,0 @@
@@ -1,230 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2016 the original author or authors. |
||||
* |
||||
* Licensed 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.springframework.boot.autoconfigure.jms.hornetq; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
import java.util.UUID; |
||||
import java.util.concurrent.atomic.AtomicInteger; |
||||
|
||||
import org.hornetq.core.remoting.impl.invm.TransportConstants; |
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties; |
||||
|
||||
/** |
||||
* Configuration properties for HornetQ. |
||||
* |
||||
* @author Stephane Nicoll |
||||
* @since 1.1.0 |
||||
* @deprecated as of 1.4 in favor of the Artemis support |
||||
*/ |
||||
@ConfigurationProperties(prefix = "spring.hornetq") |
||||
@Deprecated |
||||
public class HornetQProperties { |
||||
|
||||
/** |
||||
* HornetQ deployment mode, auto-detected by default. |
||||
*/ |
||||
private HornetQMode mode; |
||||
|
||||
/** |
||||
* HornetQ broker host. |
||||
*/ |
||||
private String host = "localhost"; |
||||
|
||||
/** |
||||
* HornetQ broker port. |
||||
*/ |
||||
private int port = 5445; |
||||
|
||||
/** |
||||
* Login user of the broker. |
||||
*/ |
||||
private String user; |
||||
|
||||
/** |
||||
* Login password of the broker. |
||||
*/ |
||||
private String password; |
||||
|
||||
private final Embedded embedded = new Embedded(); |
||||
|
||||
public HornetQMode getMode() { |
||||
return this.mode; |
||||
} |
||||
|
||||
public void setMode(HornetQMode mode) { |
||||
this.mode = mode; |
||||
} |
||||
|
||||
public String getHost() { |
||||
return this.host; |
||||
} |
||||
|
||||
public void setHost(String host) { |
||||
this.host = host; |
||||
} |
||||
|
||||
public int getPort() { |
||||
return this.port; |
||||
} |
||||
|
||||
public void setPort(int port) { |
||||
this.port = port; |
||||
} |
||||
|
||||
public String getUser() { |
||||
return this.user; |
||||
} |
||||
|
||||
public void setUser(String user) { |
||||
this.user = user; |
||||
} |
||||
|
||||
public String getPassword() { |
||||
return this.password; |
||||
} |
||||
|
||||
public void setPassword(String password) { |
||||
this.password = password; |
||||
} |
||||
|
||||
public Embedded getEmbedded() { |
||||
return this.embedded; |
||||
} |
||||
|
||||
/** |
||||
* Configuration for an embedded HornetQ server. |
||||
*/ |
||||
public static class Embedded { |
||||
|
||||
private static final AtomicInteger serverIdCounter = new AtomicInteger(); |
||||
|
||||
/** |
||||
* Server id. By default, an auto-incremented counter is used. |
||||
*/ |
||||
private int serverId = serverIdCounter.getAndIncrement(); |
||||
|
||||
/** |
||||
* Enable embedded mode if the HornetQ server APIs are available. |
||||
*/ |
||||
private boolean enabled = true; |
||||
|
||||
/** |
||||
* Enable persistent store. |
||||
*/ |
||||
private boolean persistent; |
||||
|
||||
/** |
||||
* Journal file directory. Not necessary if persistence is turned off. |
||||
*/ |
||||
private String dataDirectory; |
||||
|
||||
/** |
||||
* Comma-separated list of queues to create on startup. |
||||
*/ |
||||
private String[] queues = new String[0]; |
||||
|
||||
/** |
||||
* Comma-separated list of topics to create on startup. |
||||
*/ |
||||
private String[] topics = new String[0]; |
||||
|
||||
/** |
||||
* Cluster password. Randomly generated on startup by default. |
||||
*/ |
||||
private String clusterPassword = UUID.randomUUID().toString(); |
||||
|
||||
private boolean defaultClusterPassword = true; |
||||
|
||||
public int getServerId() { |
||||
return this.serverId; |
||||
} |
||||
|
||||
public void setServerId(int serverId) { |
||||
this.serverId = serverId; |
||||
} |
||||
|
||||
public boolean isEnabled() { |
||||
return this.enabled; |
||||
} |
||||
|
||||
public void setEnabled(boolean enabled) { |
||||
this.enabled = enabled; |
||||
} |
||||
|
||||
public boolean isPersistent() { |
||||
return this.persistent; |
||||
} |
||||
|
||||
public void setPersistent(boolean persistent) { |
||||
this.persistent = persistent; |
||||
} |
||||
|
||||
public String getDataDirectory() { |
||||
return this.dataDirectory; |
||||
} |
||||
|
||||
public void setDataDirectory(String dataDirectory) { |
||||
this.dataDirectory = dataDirectory; |
||||
} |
||||
|
||||
public String[] getQueues() { |
||||
return this.queues; |
||||
} |
||||
|
||||
public void setQueues(String[] queues) { |
||||
this.queues = queues; |
||||
} |
||||
|
||||
public String[] getTopics() { |
||||
return this.topics; |
||||
} |
||||
|
||||
public void setTopics(String[] topics) { |
||||
this.topics = topics; |
||||
} |
||||
|
||||
public String getClusterPassword() { |
||||
return this.clusterPassword; |
||||
} |
||||
|
||||
public void setClusterPassword(String clusterPassword) { |
||||
this.clusterPassword = clusterPassword; |
||||
this.defaultClusterPassword = false; |
||||
} |
||||
|
||||
public boolean isDefaultClusterPassword() { |
||||
return this.defaultClusterPassword; |
||||
} |
||||
|
||||
/** |
||||
* Creates the minimal transport parameters for an embedded transport |
||||
* configuration. |
||||
* |
||||
* @return the transport parameters |
||||
* @see TransportConstants#SERVER_ID_PROP_NAME |
||||
*/ |
||||
public Map<String, Object> generateTransportParameters() { |
||||
Map<String, Object> parameters = new HashMap<String, Object>(); |
||||
parameters.put(TransportConstants.SERVER_ID_PROP_NAME, getServerId()); |
||||
return parameters; |
||||
} |
||||
|
||||
} |
||||
|
||||
} |
||||
@ -1,64 +0,0 @@
@@ -1,64 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2016 the original author or authors. |
||||
* |
||||
* Licensed 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.springframework.boot.autoconfigure.jms.hornetq; |
||||
|
||||
import javax.jms.ConnectionFactory; |
||||
import javax.transaction.TransactionManager; |
||||
|
||||
import org.hornetq.jms.client.HornetQConnectionFactory; |
||||
|
||||
import org.springframework.beans.factory.ListableBeanFactory; |
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; |
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; |
||||
import org.springframework.boot.jta.XAConnectionFactoryWrapper; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.context.annotation.Primary; |
||||
|
||||
/** |
||||
* Configuration for HornetQ XA {@link ConnectionFactory}. |
||||
* |
||||
* @author Phillip Webb |
||||
* @since 1.2.0 |
||||
* @deprecated as of 1.4 in favor of the Artemis support |
||||
*/ |
||||
@Configuration |
||||
@ConditionalOnMissingBean(ConnectionFactory.class) |
||||
@ConditionalOnClass(TransactionManager.class) |
||||
@ConditionalOnBean(XAConnectionFactoryWrapper.class) |
||||
@Deprecated |
||||
class HornetQXAConnectionFactoryConfiguration { |
||||
|
||||
@Primary |
||||
@Bean(name = { "jmsConnectionFactory", "xaJmsConnectionFactory" }) |
||||
public ConnectionFactory jmsConnectionFactory(ListableBeanFactory beanFactory, |
||||
HornetQProperties properties, XAConnectionFactoryWrapper wrapper) |
||||
throws Exception { |
||||
return wrapper.wrapConnectionFactory( |
||||
new HornetQConnectionFactoryFactory(beanFactory, properties) |
||||
.createConnectionFactory( |
||||
SpringBootHornetQXAConnectionFactory.class)); |
||||
} |
||||
|
||||
@Bean |
||||
public HornetQConnectionFactory nonXaJmsConnectionFactory( |
||||
ListableBeanFactory beanFactory, HornetQProperties properties) { |
||||
return new HornetQConnectionFactoryFactory(beanFactory, properties) |
||||
.createConnectionFactory(SpringBootHornetQConnectionFactory.class); |
||||
} |
||||
} |
||||
@ -1,61 +0,0 @@
@@ -1,61 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2016 the original author or authors. |
||||
* |
||||
* Licensed 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.springframework.boot.autoconfigure.jms.hornetq; |
||||
|
||||
import javax.jms.Connection; |
||||
import javax.jms.JMSException; |
||||
|
||||
import org.hornetq.api.core.TransportConfiguration; |
||||
import org.hornetq.api.core.client.ServerLocator; |
||||
import org.hornetq.jms.client.HornetQConnectionFactory; |
||||
|
||||
import org.springframework.util.StringUtils; |
||||
|
||||
/** |
||||
* A {@link HornetQConnectionFactory} that manages the credentials of the connection. |
||||
* |
||||
* @author Stéphane Lagraulet |
||||
* @author Stephane Nicoll |
||||
* @deprecated as of 1.4 in favor of the Artemis support |
||||
*/ |
||||
@Deprecated |
||||
class SpringBootHornetQConnectionFactory extends HornetQConnectionFactory { |
||||
|
||||
private final HornetQProperties properties; |
||||
|
||||
SpringBootHornetQConnectionFactory(HornetQProperties properties, |
||||
ServerLocator serverLocator) { |
||||
super(serverLocator); |
||||
this.properties = properties; |
||||
} |
||||
|
||||
SpringBootHornetQConnectionFactory(HornetQProperties properties, boolean ha, |
||||
TransportConfiguration... initialConnectors) { |
||||
super(ha, initialConnectors); |
||||
this.properties = properties; |
||||
} |
||||
|
||||
@Override |
||||
public Connection createConnection() throws JMSException { |
||||
String user = this.properties.getUser(); |
||||
if (StringUtils.hasText(user)) { |
||||
return createConnection(user, this.properties.getPassword()); |
||||
} |
||||
return super.createConnection(); |
||||
} |
||||
|
||||
} |
||||
@ -1,61 +0,0 @@
@@ -1,61 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2016 the original author or authors. |
||||
* |
||||
* Licensed 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.springframework.boot.autoconfigure.jms.hornetq; |
||||
|
||||
import javax.jms.Connection; |
||||
import javax.jms.JMSException; |
||||
|
||||
import org.hornetq.api.core.TransportConfiguration; |
||||
import org.hornetq.api.core.client.ServerLocator; |
||||
import org.hornetq.jms.client.HornetQXAConnectionFactory; |
||||
|
||||
import org.springframework.util.StringUtils; |
||||
|
||||
/** |
||||
* A {@link HornetQXAConnectionFactory} that manages the credentials of the connection. |
||||
* |
||||
* @author Stéphane Lagraulet |
||||
* @author Stephane Nicoll |
||||
* @deprecated as of 1.4 in favor of the Artemis support |
||||
*/ |
||||
@Deprecated |
||||
class SpringBootHornetQXAConnectionFactory extends HornetQXAConnectionFactory { |
||||
|
||||
private final HornetQProperties properties; |
||||
|
||||
SpringBootHornetQXAConnectionFactory(HornetQProperties properties, |
||||
ServerLocator serverLocator) { |
||||
super(serverLocator); |
||||
this.properties = properties; |
||||
} |
||||
|
||||
SpringBootHornetQXAConnectionFactory(HornetQProperties properties, boolean ha, |
||||
TransportConfiguration... initialConnectors) { |
||||
super(ha, initialConnectors); |
||||
this.properties = properties; |
||||
} |
||||
|
||||
@Override |
||||
public Connection createConnection() throws JMSException { |
||||
String user = this.properties.getUser(); |
||||
if (StringUtils.hasText(user)) { |
||||
return createConnection(user, this.properties.getPassword()); |
||||
} |
||||
return super.createConnection(); |
||||
} |
||||
|
||||
} |
||||
@ -1,21 +0,0 @@
@@ -1,21 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2016 the original author or authors. |
||||
* |
||||
* Licensed 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. |
||||
*/ |
||||
|
||||
/** |
||||
* Auto-configuration for HornetQ. |
||||
* @deprecated as of 1.4 in favor of the Artemis support |
||||
*/ |
||||
package org.springframework.boot.autoconfigure.jms.hornetq; |
||||
@ -1,435 +0,0 @@
@@ -1,435 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2016 the original author or authors. |
||||
* |
||||
* Licensed 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.springframework.boot.autoconfigure.jms.hornetq; |
||||
|
||||
import java.io.File; |
||||
import java.io.IOException; |
||||
import java.util.UUID; |
||||
|
||||
import javax.jms.Connection; |
||||
import javax.jms.Destination; |
||||
import javax.jms.JMSException; |
||||
import javax.jms.Message; |
||||
import javax.jms.Session; |
||||
import javax.jms.TextMessage; |
||||
|
||||
import org.hornetq.api.core.TransportConfiguration; |
||||
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory; |
||||
import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory; |
||||
import org.hornetq.jms.client.HornetQConnectionFactory; |
||||
import org.hornetq.jms.server.config.JMSConfiguration; |
||||
import org.hornetq.jms.server.config.JMSQueueConfiguration; |
||||
import org.hornetq.jms.server.config.TopicConfiguration; |
||||
import org.hornetq.jms.server.config.impl.JMSConfigurationImpl; |
||||
import org.hornetq.jms.server.config.impl.JMSQueueConfigurationImpl; |
||||
import org.hornetq.jms.server.config.impl.TopicConfigurationImpl; |
||||
import org.hornetq.jms.server.embedded.EmbeddedJMS; |
||||
import org.junit.After; |
||||
import org.junit.Rule; |
||||
import org.junit.Test; |
||||
import org.junit.rules.TemporaryFolder; |
||||
|
||||
import org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration; |
||||
import org.springframework.boot.test.util.EnvironmentTestUtils; |
||||
import org.springframework.context.ApplicationContext; |
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.jms.core.JmsTemplate; |
||||
import org.springframework.jms.core.MessageCreator; |
||||
import org.springframework.jms.core.SessionCallback; |
||||
import org.springframework.jms.support.destination.DestinationResolver; |
||||
import org.springframework.jms.support.destination.DynamicDestinationResolver; |
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat; |
||||
import static org.mockito.Mockito.doReturn; |
||||
import static org.mockito.Mockito.mock; |
||||
import static org.mockito.Mockito.spy; |
||||
|
||||
/** |
||||
* Tests for {@link HornetQAutoConfiguration}. |
||||
* |
||||
* @author Stephane Nicoll |
||||
*/ |
||||
@Deprecated |
||||
@SuppressWarnings("deprecation") |
||||
public class HornetQAutoConfigurationTests { |
||||
|
||||
@Rule |
||||
public final TemporaryFolder folder = new TemporaryFolder(); |
||||
|
||||
private AnnotationConfigApplicationContext context; |
||||
|
||||
@After |
||||
public void tearDown() { |
||||
if (this.context != null) { |
||||
this.context.close(); |
||||
} |
||||
} |
||||
|
||||
@Test |
||||
public void nativeConnectionFactory() { |
||||
load(EmptyConfiguration.class, "spring.hornetq.mode:native"); |
||||
JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class); |
||||
HornetQConnectionFactory connectionFactory = this.context |
||||
.getBean(HornetQConnectionFactory.class); |
||||
assertThat(connectionFactory).isEqualTo(jmsTemplate.getConnectionFactory()); |
||||
assertNettyConnectionFactory(connectionFactory, "localhost", 5445); |
||||
} |
||||
|
||||
@Test |
||||
public void nativeConnectionFactoryCustomHost() { |
||||
load(EmptyConfiguration.class, "spring.hornetq.mode:native", |
||||
"spring.hornetq.host:192.168.1.144", "spring.hornetq.port:9876"); |
||||
HornetQConnectionFactory connectionFactory = this.context |
||||
.getBean(HornetQConnectionFactory.class); |
||||
assertNettyConnectionFactory(connectionFactory, "192.168.1.144", 9876); |
||||
} |
||||
|
||||
@Test |
||||
public void nativeConnectionFactoryCredentials() throws JMSException { |
||||
load(EmptyConfiguration.class, "spring.hornetq.mode:native", |
||||
"spring.hornetq.user:user", "spring.hornetq.password:secret"); |
||||
HornetQConnectionFactory connectionFactory = this.context |
||||
.getBean(HornetQConnectionFactory.class); |
||||
|
||||
// Validate the secured variant is invoked
|
||||
HornetQConnectionFactory testCf = spy(connectionFactory); |
||||
Connection connection = mock(Connection.class); |
||||
doReturn(connection).when(testCf).createConnection("user", "secret"); |
||||
|
||||
Connection actual = testCf.createConnection(); |
||||
assertThat(actual).isSameAs(connection); |
||||
} |
||||
|
||||
@Test |
||||
public void embeddedConnectionFactory() { |
||||
load(EmptyConfiguration.class, "spring.hornetq.mode:embedded"); |
||||
|
||||
HornetQProperties properties = this.context.getBean(HornetQProperties.class); |
||||
assertThat(properties.getMode()).isEqualTo(HornetQMode.EMBEDDED); |
||||
|
||||
assertThat(this.context.getBeansOfType(EmbeddedJMS.class)).hasSize(1); |
||||
org.hornetq.core.config.Configuration configuration = this.context |
||||
.getBean(org.hornetq.core.config.Configuration.class); |
||||
assertThat(configuration.isPersistenceEnabled()).isFalse(); |
||||
assertThat(configuration.isSecurityEnabled()).isFalse(); |
||||
|
||||
HornetQConnectionFactory connectionFactory = this.context |
||||
.getBean(HornetQConnectionFactory.class); |
||||
assertInVmConnectionFactory(connectionFactory); |
||||
} |
||||
|
||||
@Test |
||||
public void embeddedConnectionFactoryByDefault() { |
||||
// No mode is specified
|
||||
load(EmptyConfiguration.class); |
||||
|
||||
assertThat(this.context.getBeansOfType(EmbeddedJMS.class)).hasSize(1); |
||||
org.hornetq.core.config.Configuration configuration = this.context |
||||
.getBean(org.hornetq.core.config.Configuration.class); |
||||
assertThat(configuration.isPersistenceEnabled()).isFalse(); |
||||
assertThat(configuration.isSecurityEnabled()).isFalse(); |
||||
|
||||
HornetQConnectionFactory connectionFactory = this.context |
||||
.getBean(HornetQConnectionFactory.class); |
||||
assertInVmConnectionFactory(connectionFactory); |
||||
} |
||||
|
||||
@Test |
||||
public void nativeConnectionFactoryIfEmbeddedServiceDisabledExplicitly() { |
||||
// No mode is specified
|
||||
load(EmptyConfiguration.class, "spring.hornetq.embedded.enabled:false"); |
||||
|
||||
assertThat(this.context.getBeansOfType(EmbeddedJMS.class)).isEmpty(); |
||||
|
||||
HornetQConnectionFactory connectionFactory = this.context |
||||
.getBean(HornetQConnectionFactory.class); |
||||
assertNettyConnectionFactory(connectionFactory, "localhost", 5445); |
||||
} |
||||
|
||||
@Test |
||||
public void embeddedConnectionFactoryEvenIfEmbeddedServiceDisabled() { |
||||
// No mode is specified
|
||||
load(EmptyConfiguration.class, "spring.hornetq.mode:embedded", |
||||
"spring.hornetq.embedded.enabled:false"); |
||||
|
||||
assertThat(this.context.getBeansOfType(EmbeddedJMS.class)).isEmpty(); |
||||
|
||||
HornetQConnectionFactory connectionFactory = this.context |
||||
.getBean(HornetQConnectionFactory.class); |
||||
assertInVmConnectionFactory(connectionFactory); |
||||
} |
||||
|
||||
@Test |
||||
public void embeddedServerWithDestinations() { |
||||
load(EmptyConfiguration.class, "spring.hornetq.embedded.queues=Queue1,Queue2", |
||||
"spring.hornetq.embedded.topics=Topic1"); |
||||
|
||||
DestinationChecker checker = new DestinationChecker(this.context); |
||||
checker.checkQueue("Queue1", true); |
||||
checker.checkQueue("Queue2", true); |
||||
checker.checkQueue("QueueDoesNotExist", false); |
||||
|
||||
checker.checkTopic("Topic1", true); |
||||
checker.checkTopic("TopicDoesNotExist", false); |
||||
} |
||||
|
||||
@Test |
||||
public void embeddedServerWithDestinationConfig() { |
||||
load(DestinationConfiguration.class); |
||||
|
||||
DestinationChecker checker = new DestinationChecker(this.context); |
||||
checker.checkQueue("sampleQueue", true); |
||||
checker.checkTopic("sampleTopic", true); |
||||
} |
||||
|
||||
@Test |
||||
public void embeddedServiceWithCustomJmsConfiguration() { |
||||
// Ignored with custom config
|
||||
load(CustomJmsConfiguration.class, |
||||
"spring.hornetq.embedded.queues=Queue1,Queue2"); |
||||
DestinationChecker checker = new DestinationChecker(this.context); |
||||
checker.checkQueue("custom", true); // See CustomJmsConfiguration
|
||||
|
||||
checker.checkQueue("Queue1", false); |
||||
checker.checkQueue("Queue2", false); |
||||
} |
||||
|
||||
@Test |
||||
public void embeddedServiceWithCustomHornetQConfiguration() { |
||||
load(CustomHornetQConfiguration.class); |
||||
org.hornetq.core.config.Configuration configuration = this.context |
||||
.getBean(org.hornetq.core.config.Configuration.class); |
||||
assertThat(configuration.getName()).isEqualTo("customFooBar"); |
||||
} |
||||
|
||||
@Test |
||||
public void embeddedWithPersistentMode() throws IOException, JMSException { |
||||
File dataFolder = this.folder.newFolder(); |
||||
|
||||
// Start the server and post a message to some queue
|
||||
load(EmptyConfiguration.class, "spring.hornetq.embedded.queues=TestQueue", |
||||
"spring.hornetq.embedded.persistent:true", |
||||
"spring.hornetq.embedded.dataDirectory:" + dataFolder.getAbsolutePath()); |
||||
|
||||
final String msgId = UUID.randomUUID().toString(); |
||||
JmsTemplate jmsTemplate = this.context.getBean(JmsTemplate.class); |
||||
jmsTemplate.send("TestQueue", new MessageCreator() { |
||||
@Override |
||||
public Message createMessage(Session session) throws JMSException { |
||||
return session.createTextMessage(msgId); |
||||
} |
||||
}); |
||||
this.context.close(); // Shutdown the broker
|
||||
|
||||
// Start the server again and check if our message is still here
|
||||
load(EmptyConfiguration.class, "spring.hornetq.embedded.queues=TestQueue", |
||||
"spring.hornetq.embedded.persistent:true", |
||||
"spring.hornetq.embedded.dataDirectory:" + dataFolder.getAbsolutePath()); |
||||
|
||||
JmsTemplate jmsTemplate2 = this.context.getBean(JmsTemplate.class); |
||||
jmsTemplate2.setReceiveTimeout(1000L); |
||||
Message message = jmsTemplate2.receive("TestQueue"); |
||||
assertThat(message).isNotNull(); |
||||
assertThat(((TextMessage) message).getText()).isEqualTo(msgId); |
||||
} |
||||
|
||||
@Test |
||||
public void severalEmbeddedBrokers() { |
||||
load(EmptyConfiguration.class, "spring.hornetq.embedded.queues=Queue1"); |
||||
|
||||
AnnotationConfigApplicationContext anotherContext = doLoad( |
||||
EmptyConfiguration.class, "spring.hornetq.embedded.queues=Queue2"); |
||||
|
||||
try { |
||||
HornetQProperties properties = this.context.getBean(HornetQProperties.class); |
||||
HornetQProperties anotherProperties = anotherContext |
||||
.getBean(HornetQProperties.class); |
||||
assertThat(properties.getEmbedded().getServerId() < anotherProperties |
||||
.getEmbedded().getServerId()).isTrue(); |
||||
|
||||
DestinationChecker checker = new DestinationChecker(this.context); |
||||
checker.checkQueue("Queue1", true); |
||||
checker.checkQueue("Queue2", false); |
||||
|
||||
DestinationChecker anotherChecker = new DestinationChecker(anotherContext); |
||||
anotherChecker.checkQueue("Queue2", true); |
||||
anotherChecker.checkQueue("Queue1", false); |
||||
} |
||||
finally { |
||||
anotherContext.close(); |
||||
} |
||||
} |
||||
|
||||
@Test |
||||
public void connectToASpecificEmbeddedBroker() { |
||||
load(EmptyConfiguration.class, "spring.hornetq.embedded.serverId=93", |
||||
"spring.hornetq.embedded.queues=Queue1"); |
||||
|
||||
AnnotationConfigApplicationContext anotherContext = doLoad( |
||||
EmptyConfiguration.class, "spring.hornetq.mode=embedded", |
||||
"spring.hornetq.embedded.serverId=93", // Connect to the "main" broker
|
||||
"spring.hornetq.embedded.enabled=false"); // do not start a specific one
|
||||
|
||||
try { |
||||
DestinationChecker checker = new DestinationChecker(this.context); |
||||
checker.checkQueue("Queue1", true); |
||||
|
||||
DestinationChecker anotherChecker = new DestinationChecker(anotherContext); |
||||
anotherChecker.checkQueue("Queue1", true); |
||||
} |
||||
finally { |
||||
anotherContext.close(); |
||||
} |
||||
} |
||||
|
||||
private TransportConfiguration assertInVmConnectionFactory( |
||||
HornetQConnectionFactory connectionFactory) { |
||||
TransportConfiguration transportConfig = getSingleTransportConfiguration( |
||||
connectionFactory); |
||||
assertThat(transportConfig.getFactoryClassName()) |
||||
.isEqualTo(InVMConnectorFactory.class.getName()); |
||||
return transportConfig; |
||||
} |
||||
|
||||
private TransportConfiguration assertNettyConnectionFactory( |
||||
HornetQConnectionFactory connectionFactory, String host, int port) { |
||||
TransportConfiguration transportConfig = getSingleTransportConfiguration( |
||||
connectionFactory); |
||||
assertThat(transportConfig.getFactoryClassName()) |
||||
.isEqualTo(NettyConnectorFactory.class.getName()); |
||||
assertThat(transportConfig.getParams().get("host")).isEqualTo(host); |
||||
assertThat(transportConfig.getParams().get("port")).isEqualTo(port); |
||||
return transportConfig; |
||||
} |
||||
|
||||
private TransportConfiguration getSingleTransportConfiguration( |
||||
HornetQConnectionFactory connectionFactory) { |
||||
TransportConfiguration[] transportConfigurations = connectionFactory |
||||
.getServerLocator().getStaticTransportConfigurations(); |
||||
assertThat(transportConfigurations.length).isEqualTo(1); |
||||
return transportConfigurations[0]; |
||||
} |
||||
|
||||
private void load(Class<?> config, String... environment) { |
||||
this.context = doLoad(config, environment); |
||||
} |
||||
|
||||
private AnnotationConfigApplicationContext doLoad(Class<?> config, |
||||
String... environment) { |
||||
AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(); |
||||
applicationContext.register(config); |
||||
applicationContext.register(HornetQAutoConfiguration.class, |
||||
JmsAutoConfiguration.class); |
||||
EnvironmentTestUtils.addEnvironment(applicationContext, environment); |
||||
applicationContext.refresh(); |
||||
return applicationContext; |
||||
} |
||||
|
||||
private final static class DestinationChecker { |
||||
|
||||
private final JmsTemplate jmsTemplate; |
||||
|
||||
private final DestinationResolver destinationResolver; |
||||
|
||||
private DestinationChecker(ApplicationContext applicationContext) { |
||||
this.jmsTemplate = applicationContext.getBean(JmsTemplate.class); |
||||
this.destinationResolver = new DynamicDestinationResolver(); |
||||
} |
||||
|
||||
public void checkQueue(String name, boolean shouldExist) { |
||||
checkDestination(name, false, shouldExist); |
||||
} |
||||
|
||||
public void checkTopic(String name, boolean shouldExist) { |
||||
checkDestination(name, true, shouldExist); |
||||
} |
||||
|
||||
public void checkDestination(final String name, final boolean pubSub, |
||||
final boolean shouldExist) { |
||||
this.jmsTemplate.execute(new SessionCallback<Void>() { |
||||
@Override |
||||
public Void doInJms(Session session) throws JMSException { |
||||
try { |
||||
Destination destination = DestinationChecker.this.destinationResolver |
||||
.resolveDestinationName(session, name, pubSub); |
||||
if (!shouldExist) { |
||||
throw new IllegalStateException("Destination '" + name |
||||
+ "' was not expected but got " + destination); |
||||
} |
||||
} |
||||
catch (JMSException e) { |
||||
if (shouldExist) { |
||||
throw new IllegalStateException("Destination '" + name |
||||
+ "' was expected but got " + e.getMessage()); |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
@Configuration |
||||
protected static class EmptyConfiguration { |
||||
} |
||||
|
||||
@Configuration |
||||
protected static class DestinationConfiguration { |
||||
|
||||
@Bean |
||||
JMSQueueConfiguration sampleQueueConfiguration() { |
||||
return new JMSQueueConfigurationImpl("sampleQueue", "foo=bar", false, |
||||
"/queue/1"); |
||||
} |
||||
|
||||
@Bean |
||||
TopicConfiguration sampleTopicConfiguration() { |
||||
return new TopicConfigurationImpl("sampleTopic", "/topic/1"); |
||||
} |
||||
} |
||||
|
||||
@Configuration |
||||
protected static class CustomJmsConfiguration { |
||||
|
||||
@Bean |
||||
public JMSConfiguration myJmsConfiguration() { |
||||
JMSConfiguration config = new JMSConfigurationImpl(); |
||||
config.getQueueConfigurations() |
||||
.add(new JMSQueueConfigurationImpl("custom", null, false)); |
||||
return config; |
||||
} |
||||
} |
||||
|
||||
@Configuration |
||||
protected static class CustomHornetQConfiguration { |
||||
|
||||
@Bean |
||||
public HornetQConfigurationCustomizer myHornetQCustomize() { |
||||
return new HornetQConfigurationCustomizer() { |
||||
@Override |
||||
public void customize( |
||||
org.hornetq.core.config.Configuration configuration) { |
||||
configuration.setClusterPassword("Foobar"); |
||||
configuration.setName("customFooBar"); |
||||
} |
||||
}; |
||||
} |
||||
} |
||||
|
||||
} |
||||
@ -1,71 +0,0 @@
@@ -1,71 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2016 the original author or authors. |
||||
* |
||||
* Licensed 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.springframework.boot.autoconfigure.jms.hornetq; |
||||
|
||||
import org.hornetq.core.config.Configuration; |
||||
import org.hornetq.core.server.JournalType; |
||||
import org.junit.Test; |
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat; |
||||
|
||||
/** |
||||
* Tests for {@link HornetQEmbeddedConfigurationFactory}. |
||||
* |
||||
* @author Stephane Nicoll |
||||
* @author Phillip Webb |
||||
*/ |
||||
@Deprecated |
||||
public class HornetQEmbeddedConfigurationFactoryTests { |
||||
|
||||
@Test |
||||
public void defaultDataDir() { |
||||
HornetQProperties properties = new HornetQProperties(); |
||||
properties.getEmbedded().setPersistent(true); |
||||
Configuration configuration = new HornetQEmbeddedConfigurationFactory(properties) |
||||
.createConfiguration(); |
||||
assertThat(configuration.getJournalDirectory()) |
||||
.startsWith(System.getProperty("java.io.tmpdir")).endsWith("/journal"); |
||||
} |
||||
|
||||
@Test |
||||
public void persistenceSetup() { |
||||
HornetQProperties properties = new HornetQProperties(); |
||||
properties.getEmbedded().setPersistent(true); |
||||
Configuration configuration = new HornetQEmbeddedConfigurationFactory(properties) |
||||
.createConfiguration(); |
||||
assertThat(configuration.isPersistenceEnabled()).isTrue(); |
||||
assertThat(configuration.getJournalType()).isEqualTo(JournalType.NIO); |
||||
} |
||||
|
||||
@Test |
||||
public void generatedClusterPassword() throws Exception { |
||||
HornetQProperties properties = new HornetQProperties(); |
||||
Configuration configuration = new HornetQEmbeddedConfigurationFactory(properties) |
||||
.createConfiguration(); |
||||
assertThat(configuration.getClusterPassword().length()).isEqualTo(36); |
||||
} |
||||
|
||||
@Test |
||||
public void specificClusterPassword() throws Exception { |
||||
HornetQProperties properties = new HornetQProperties(); |
||||
properties.getEmbedded().setClusterPassword("password"); |
||||
Configuration configuration = new HornetQEmbeddedConfigurationFactory(properties) |
||||
.createConfiguration(); |
||||
assertThat(configuration.getClusterPassword()).isEqualTo("password"); |
||||
} |
||||
|
||||
} |
||||
@ -1,44 +0,0 @@
@@ -1,44 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<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/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<parent> |
||||
<!-- Your own application should inherit from spring-boot-starter-parent --> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-samples</artifactId> |
||||
<version>2.0.0.BUILD-SNAPSHOT</version> |
||||
</parent> |
||||
<artifactId>spring-boot-sample-hornetq</artifactId> |
||||
<name>Spring Boot HornetQ Sample</name> |
||||
<description>Spring Boot HornetQ Sample</description> |
||||
<url>http://projects.spring.io/spring-boot/</url> |
||||
<organization> |
||||
<name>Pivotal Software, Inc.</name> |
||||
<url>http://www.spring.io</url> |
||||
</organization> |
||||
<properties> |
||||
<main.basedir>${basedir}/../..</main.basedir> |
||||
</properties> |
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-hornetq</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.hornetq</groupId> |
||||
<artifactId>hornetq-jms-server</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-test</artifactId> |
||||
<scope>test</scope> |
||||
</dependency> |
||||
</dependencies> |
||||
<build> |
||||
<plugins> |
||||
<plugin> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-maven-plugin</artifactId> |
||||
</plugin> |
||||
</plugins> |
||||
</build> |
||||
</project> |
||||
@ -1,65 +0,0 @@
@@ -1,65 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2015 the original author or authors. |
||||
* |
||||
* Licensed 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 sample.hornetq; |
||||
|
||||
import javax.jms.ConnectionFactory; |
||||
import javax.jms.JMSException; |
||||
import javax.jms.Message; |
||||
import javax.jms.MessageListener; |
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.boot.SpringApplication; |
||||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.jms.listener.DefaultMessageListenerContainer; |
||||
import org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor; |
||||
|
||||
@SpringBootApplication |
||||
public class SampleHornetQApplication { |
||||
|
||||
@Autowired |
||||
private ConnectionFactory connectionFactory; |
||||
|
||||
@Bean |
||||
public ScheduledAnnotationBeanPostProcessor scheduledAnnotationBeanPostProcessor() { |
||||
return new ScheduledAnnotationBeanPostProcessor(); |
||||
} |
||||
|
||||
@Bean |
||||
public DefaultMessageListenerContainer messageListener() { |
||||
DefaultMessageListenerContainer container = new DefaultMessageListenerContainer(); |
||||
container.setConnectionFactory(this.connectionFactory); |
||||
container.setDestinationName("testQueue"); |
||||
container.setMessageListener(new MessageListener() { |
||||
@Override |
||||
public void onMessage(Message message) { |
||||
try { |
||||
System.out.println(message.getBody(Object.class)); |
||||
} |
||||
catch (JMSException ex) { |
||||
ex.printStackTrace(); |
||||
} |
||||
} |
||||
}); |
||||
return container; |
||||
} |
||||
|
||||
public static void main(String[] args) throws Exception { |
||||
SpringApplication.run(SampleHornetQApplication.class, args); |
||||
} |
||||
|
||||
} |
||||
@ -1,35 +0,0 @@
@@ -1,35 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2013 the original author or authors. |
||||
* |
||||
* Licensed 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 sample.hornetq; |
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.jms.core.JmsTemplate; |
||||
import org.springframework.scheduling.annotation.Scheduled; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
@Component |
||||
public class Sender { |
||||
|
||||
@Autowired |
||||
private JmsTemplate jmsTemplate; |
||||
|
||||
@Scheduled(fixedDelay = 1000L) |
||||
public void send() { |
||||
this.jmsTemplate.convertAndSend("testQueue", "Hello"); |
||||
} |
||||
|
||||
} |
||||
@ -1,3 +0,0 @@
@@ -1,3 +0,0 @@
|
||||
spring.hornetq.mode=embedded |
||||
spring.hornetq.embedded.enabled=true |
||||
spring.hornetq.embedded.queues=testQueue,anotherQueue |
||||
@ -1,57 +0,0 @@
@@ -1,57 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<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/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<parent> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starters</artifactId> |
||||
<version>2.0.0.BUILD-SNAPSHOT</version> |
||||
</parent> |
||||
<artifactId>spring-boot-starter-hornetq</artifactId> |
||||
<name>spring-boot-starter-hornetq (DEPRECATED)</name> |
||||
<description>Starter for JMS messaging using HornetQ. Deprecated as of 1.4 in favor |
||||
of spring-boot-starter-artemis</description> |
||||
<url>http://projects.spring.io/spring-boot/</url> |
||||
<organization> |
||||
<name>Pivotal Software, Inc.</name> |
||||
<url>http://www.spring.io</url> |
||||
</organization> |
||||
<properties> |
||||
<main.basedir>${basedir}/../..</main.basedir> |
||||
</properties> |
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework</groupId> |
||||
<artifactId>spring-jms</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.hornetq</groupId> |
||||
<artifactId>hornetq-jms-client</artifactId> |
||||
</dependency> |
||||
</dependencies> |
||||
<build> |
||||
<plugins> |
||||
<plugin> |
||||
<groupId>org.basepom.maven</groupId> |
||||
<artifactId>duplicate-finder-maven-plugin</artifactId> |
||||
<executions> |
||||
<execution> |
||||
<id>duplicate-dependencies</id> |
||||
<phase>validate</phase> |
||||
<goals> |
||||
<goal>check</goal> |
||||
</goals> |
||||
<configuration> |
||||
<ignoredResourcePatterns> |
||||
<ignoredResourcePattern>org/hornetq/utils.HornetQUtil(Bundle|Logger).i18n.properties</ignoredResourcePattern> |
||||
</ignoredResourcePatterns> |
||||
</configuration> |
||||
</execution> |
||||
</executions> |
||||
</plugin> |
||||
</plugins> |
||||
</build> |
||||
</project> |
||||
@ -1,47 +0,0 @@
@@ -1,47 +0,0 @@
|
||||
/* |
||||
* Copyright 2012-2016 the original author or authors. |
||||
* |
||||
* Licensed 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.springframework.boot.starter.hornetq; |
||||
|
||||
import javax.annotation.PostConstruct; |
||||
|
||||
import org.apache.commons.logging.Log; |
||||
import org.apache.commons.logging.LogFactory; |
||||
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; |
||||
import org.springframework.context.annotation.Configuration; |
||||
|
||||
/** |
||||
* {@link EnableAutoConfiguration Auto-configuration} to print a deprecation warning about |
||||
* the starter. |
||||
* |
||||
* @author Stephane Nicoll |
||||
* @since 1.4.0 |
||||
*/ |
||||
@Configuration |
||||
@Deprecated |
||||
public class HornetQStarterDeprecationWarningAutoConfiguration { |
||||
|
||||
private static final Log logger = LogFactory |
||||
.getLog(HornetQStarterDeprecationWarningAutoConfiguration.class); |
||||
|
||||
@PostConstruct |
||||
public void logWarning() { |
||||
logger.warn("spring-boot-starter-hornetq is deprecated as of Spring Boot 1.4, " |
||||
+ "please migrate to spring-boot-starter-artemis"); |
||||
} |
||||
|
||||
} |
||||
@ -1,3 +0,0 @@
@@ -1,3 +0,0 @@
|
||||
# Auto Configure |
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ |
||||
org.springframework.boot.starter.hornetq.HornetQStarterDeprecationWarningAutoConfiguration |
||||
Loading…
Reference in new issue