|
|
@ -31,6 +31,7 @@ import org.springframework.jms.annotation.JmsListenerAnnotationBeanPostProcessor
|
|
|
|
import org.springframework.jms.config.DefaultJmsListenerContainerFactory;
|
|
|
|
import org.springframework.jms.config.DefaultJmsListenerContainerFactory;
|
|
|
|
import org.springframework.jms.core.JmsMessagingTemplate;
|
|
|
|
import org.springframework.jms.core.JmsMessagingTemplate;
|
|
|
|
import org.springframework.jms.core.JmsTemplate;
|
|
|
|
import org.springframework.jms.core.JmsTemplate;
|
|
|
|
|
|
|
|
import org.springframework.jms.support.destination.DestinationResolver;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* {@link EnableAutoConfiguration Auto-configuration} for Spring JMS.
|
|
|
|
* {@link EnableAutoConfiguration Auto-configuration} for Spring JMS.
|
|
|
@ -50,11 +51,17 @@ public class JmsAutoConfiguration {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private ConnectionFactory connectionFactory;
|
|
|
|
private ConnectionFactory connectionFactory;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired(required = false)
|
|
|
|
|
|
|
|
private DestinationResolver destinationResolver;
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
@ConditionalOnMissingBean
|
|
|
|
@ConditionalOnMissingBean
|
|
|
|
public JmsTemplate jmsTemplate() {
|
|
|
|
public JmsTemplate jmsTemplate() {
|
|
|
|
JmsTemplate jmsTemplate = new JmsTemplate(this.connectionFactory);
|
|
|
|
JmsTemplate jmsTemplate = new JmsTemplate(this.connectionFactory);
|
|
|
|
jmsTemplate.setPubSubDomain(this.properties.isPubSubDomain());
|
|
|
|
jmsTemplate.setPubSubDomain(this.properties.isPubSubDomain());
|
|
|
|
|
|
|
|
if (this.destinationResolver != null) {
|
|
|
|
|
|
|
|
jmsTemplate.setDestinationResolver(this.destinationResolver);
|
|
|
|
|
|
|
|
}
|
|
|
|
return jmsTemplate;
|
|
|
|
return jmsTemplate;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -73,12 +80,18 @@ public class JmsAutoConfiguration {
|
|
|
|
@ConditionalOnBean(JmsListenerAnnotationBeanPostProcessor.class)
|
|
|
|
@ConditionalOnBean(JmsListenerAnnotationBeanPostProcessor.class)
|
|
|
|
protected static class AnnotationDrivenConfiguration {
|
|
|
|
protected static class AnnotationDrivenConfiguration {
|
|
|
|
|
|
|
|
|
|
|
|
@ConditionalOnMissingBean(name = "jmsListenerContainerFactory")
|
|
|
|
@Autowired(required = false)
|
|
|
|
|
|
|
|
private DestinationResolver destinationResolver;
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
|
|
|
|
@ConditionalOnMissingBean(name = "jmsListenerContainerFactory")
|
|
|
|
public DefaultJmsListenerContainerFactory jmsListenerContainerFactory(
|
|
|
|
public DefaultJmsListenerContainerFactory jmsListenerContainerFactory(
|
|
|
|
ConnectionFactory connectionFactory) {
|
|
|
|
ConnectionFactory connectionFactory) {
|
|
|
|
DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
|
|
|
|
DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
|
|
|
|
factory.setConnectionFactory(connectionFactory);
|
|
|
|
factory.setConnectionFactory(connectionFactory);
|
|
|
|
|
|
|
|
if (this.destinationResolver != null) {
|
|
|
|
|
|
|
|
factory.setDestinationResolver(this.destinationResolver);
|
|
|
|
|
|
|
|
}
|
|
|
|
return factory;
|
|
|
|
return factory;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|