use of org.springframework.jms.listener.SimpleMessageListenerContainer in project camel by apache.
the class JmsConfiguration method configureMessageListenerContainer.
protected void configureMessageListenerContainer(AbstractMessageListenerContainer container, JmsEndpoint endpoint) throws Exception {
container.setConnectionFactory(getListenerConnectionFactory());
if (endpoint instanceof DestinationEndpoint) {
container.setDestinationResolver(createDestinationResolver((DestinationEndpoint) endpoint));
} else if (destinationResolver != null) {
container.setDestinationResolver(destinationResolver);
}
container.setAutoStartup(autoStartup);
if (durableSubscriptionName != null) {
container.setDurableSubscriptionName(durableSubscriptionName);
container.setSubscriptionDurable(true);
}
if (clientId != null) {
container.setClientId(clientId);
}
if (exceptionListener != null) {
container.setExceptionListener(exceptionListener);
}
if (errorHandler != null) {
container.setErrorHandler(errorHandler);
} else {
ErrorHandler handler = new DefaultSpringErrorHandler(endpoint.getCamelContext(), EndpointMessageListener.class, getErrorHandlerLoggingLevel(), isErrorHandlerLogStackTrace());
container.setErrorHandler(handler);
}
container.setAcceptMessagesWhileStopping(acceptMessagesWhileStopping);
container.setExposeListenerSession(exposeListenerSession);
container.setSessionTransacted(transacted);
if (transacted) {
container.setSessionAcknowledgeMode(Session.SESSION_TRANSACTED);
} else {
if (acknowledgementMode >= 0) {
container.setSessionAcknowledgeMode(acknowledgementMode);
} else if (acknowledgementModeName != null) {
container.setSessionAcknowledgeModeName(acknowledgementModeName);
}
}
if (endpoint.getSelector() != null && endpoint.getSelector().length() != 0) {
container.setMessageSelector(endpoint.getSelector());
}
if (container instanceof DefaultMessageListenerContainer) {
DefaultMessageListenerContainer listenerContainer = (DefaultMessageListenerContainer) container;
configureDefaultMessageListenerContainer(endpoint, listenerContainer);
} else if (container instanceof SimpleMessageListenerContainer) {
SimpleMessageListenerContainer listenerContainer = (SimpleMessageListenerContainer) container;
configureSimpleMessageListenerContainer(listenerContainer);
}
}
use of org.springframework.jms.listener.SimpleMessageListenerContainer in project av-service by dvoraka.
the class JmsFileClientConfig method messageListenerContainer.
@Bean
public SimpleMessageListenerContainer messageListenerContainer(ConnectionFactory connectionFactory, MessageListener messageListener) {
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
container.setDestinationName(resultDestination);
container.setMessageListener(messageListener);
return container;
}
use of org.springframework.jms.listener.SimpleMessageListenerContainer in project tutorials by eugenp.
the class JmsServer method listener.
@Bean
SimpleMessageListenerContainer listener(ConnectionFactory factory, JmsInvokerServiceExporter exporter) {
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
container.setConnectionFactory(factory);
container.setDestinationName("remotingQueue");
container.setConcurrentConsumers(1);
container.setMessageListener(exporter);
return container;
}
use of org.springframework.jms.listener.SimpleMessageListenerContainer in project spring-integration by spring-projects.
the class JmsChannelFactoryBean method createContainer.
private AbstractMessageListenerContainer createContainer() throws Exception {
if (this.containerType == null) {
this.containerType = DefaultMessageListenerContainer.class;
}
AbstractMessageListenerContainer container = this.containerType.newInstance();
container.setAcceptMessagesWhileStopping(this.acceptMessagesWhileStopping);
container.setAutoStartup(this.autoStartup);
container.setClientId(this.clientId);
container.setConnectionFactory(this.connectionFactory);
if (this.destination != null) {
container.setDestination(this.destination);
}
if (this.destinationName != null) {
container.setDestinationName(this.destinationName);
}
if (this.destinationResolver != null) {
container.setDestinationResolver(this.destinationResolver);
}
container.setDurableSubscriptionName(this.durableSubscriptionName);
container.setErrorHandler(this.errorHandler);
container.setExceptionListener(this.exceptionListener);
if (this.exposeListenerSession != null) {
container.setExposeListenerSession(this.exposeListenerSession);
}
container.setMessageSelector(this.messageSelector);
if (this.phase != null) {
container.setPhase(this.phase);
}
if (this.pubSubDomain != null) {
container.setPubSubDomain(this.pubSubDomain);
}
container.setSessionAcknowledgeMode(this.sessionAcknowledgeMode);
container.setSessionTransacted(this.sessionTransacted);
container.setSubscriptionDurable(this.subscriptionDurable);
container.setSubscriptionShared(this.subscriptionShared);
if (container instanceof DefaultMessageListenerContainer) {
DefaultMessageListenerContainer dmlc = (DefaultMessageListenerContainer) container;
if (this.cacheLevelName != null) {
dmlc.setCacheLevelName(this.cacheLevelName);
}
if (this.cacheLevel != null) {
dmlc.setCacheLevel(this.cacheLevel);
}
if (StringUtils.hasText(this.concurrency)) {
dmlc.setConcurrency(this.concurrency);
}
if (this.concurrentConsumers != null) {
dmlc.setConcurrentConsumers(this.concurrentConsumers);
}
if (this.maxConcurrentConsumers != null) {
dmlc.setMaxConcurrentConsumers(this.maxConcurrentConsumers);
}
if (this.idleTaskExecutionLimit != null) {
dmlc.setIdleTaskExecutionLimit(this.idleTaskExecutionLimit);
}
if (this.maxMessagesPerTask != null) {
dmlc.setMaxMessagesPerTask(this.maxMessagesPerTask);
}
dmlc.setPubSubNoLocal(this.pubSubNoLocal);
if (this.receiveTimeout != null) {
dmlc.setReceiveTimeout(this.receiveTimeout);
}
if (this.recoveryInterval != null) {
dmlc.setRecoveryInterval(this.recoveryInterval);
}
dmlc.setTaskExecutor(this.taskExecutor);
dmlc.setTransactionManager(this.transactionManager);
if (this.transactionName != null) {
dmlc.setTransactionName(this.transactionName);
}
if (this.transactionTimeout != null) {
dmlc.setTransactionTimeout(this.transactionTimeout);
}
} else if (container instanceof SimpleMessageListenerContainer) {
SimpleMessageListenerContainer smlc = (SimpleMessageListenerContainer) container;
if (StringUtils.hasText(this.concurrency)) {
smlc.setConcurrency(this.concurrency);
}
if (this.concurrentConsumers != null) {
smlc.setConcurrentConsumers(this.concurrentConsumers);
}
smlc.setPubSubNoLocal(this.pubSubNoLocal);
smlc.setTaskExecutor(this.taskExecutor);
}
return container;
}
use of org.springframework.jms.listener.SimpleMessageListenerContainer in project spring-integration by spring-projects.
the class JmsChannelParserTests method withSimpleContainer.
@Test
public void withSimpleContainer() {
SimpleMessageListenerContainer container = TestUtils.getPropertyValue(withSimpleContainer, "container", SimpleMessageListenerContainer.class);
assertEquals("simple.container.queue", container.getDestinationName());
}
Aggregations