use of org.springframework.integration.jms.PollableJmsChannel in project spring-integration by spring-projects.
the class JmsChannelFactoryBean method createInstance.
@Override
protected AbstractJmsChannel createInstance() throws Exception {
this.initializeJmsTemplate();
if (this.messageDriven) {
this.container = createContainer();
SubscribableJmsChannel subscribableJmsChannel = new SubscribableJmsChannel(this.container, this.jmsTemplate);
subscribableJmsChannel.setMaxSubscribers(this.maxSubscribers);
this.channel = subscribableJmsChannel;
} else {
Assert.isTrue(!Boolean.TRUE.equals(this.pubSubDomain), "A JMS Topic-backed 'publish-subscribe-channel' must be message-driven.");
PollableJmsChannel pollableJmschannel = new PollableJmsChannel(this.jmsTemplate);
if (this.messageSelector != null) {
pollableJmschannel.setMessageSelector(this.messageSelector);
}
this.channel = pollableJmschannel;
}
if (!CollectionUtils.isEmpty(this.interceptors)) {
this.channel.setInterceptors(this.interceptors);
}
this.channel.setBeanName(this.beanName);
if (this.getBeanFactory() != null) {
this.channel.setBeanFactory(this.getBeanFactory());
}
this.channel.afterPropertiesSet();
return this.channel;
}
use of org.springframework.integration.jms.PollableJmsChannel in project spring-integration by spring-projects.
the class JmsChannelParserTests method selectorPollableChannel.
@Test
public void selectorPollableChannel() {
assertEquals(PollableJmsChannel.class, pollableWithSelectorChannel.getClass());
PollableJmsChannel channel = (PollableJmsChannel) pollableWithSelectorChannel;
DirectFieldAccessor accessor = new DirectFieldAccessor(channel);
JmsTemplate jmsTemplate = (JmsTemplate) accessor.getPropertyValue("jmsTemplate");
assertEquals(queue, jmsTemplate.getDefaultDestination());
assertEquals("foo='bar'", accessor.getPropertyValue("messageSelector"));
}
use of org.springframework.integration.jms.PollableJmsChannel in project spring-integration by spring-projects.
the class JmsChannelParserTests method queueReferencePollableChannel.
@Test
public void queueReferencePollableChannel() {
assertEquals(PollableJmsChannel.class, pollableQueueReferenceChannel.getClass());
PollableJmsChannel channel = (PollableJmsChannel) pollableQueueReferenceChannel;
DirectFieldAccessor accessor = new DirectFieldAccessor(channel);
JmsTemplate jmsTemplate = (JmsTemplate) accessor.getPropertyValue("jmsTemplate");
assertEquals(queue, jmsTemplate.getDefaultDestination());
}
use of org.springframework.integration.jms.PollableJmsChannel in project spring-integration by spring-projects.
the class JmsChannelParserTests method queueNamePollableChannel.
@Test
public void queueNamePollableChannel() {
assertEquals(PollableJmsChannel.class, pollableQueueNameChannel.getClass());
PollableJmsChannel channel = (PollableJmsChannel) pollableQueueNameChannel;
DirectFieldAccessor accessor = new DirectFieldAccessor(channel);
JmsTemplate jmsTemplate = (JmsTemplate) accessor.getPropertyValue("jmsTemplate");
assertEquals("foo", jmsTemplate.getDefaultDestinationName());
}
Aggregations