container.setSessionAcknowledgeModeName(acknowledgementModeName);
}
if (container instanceof DefaultMessageListenerContainer) {
// this includes DefaultMessageListenerContainer102
DefaultMessageListenerContainer listenerContainer = (DefaultMessageListenerContainer)container;
if (concurrentConsumers >= 0) {
listenerContainer.setConcurrentConsumers(concurrentConsumers);
}
if (cacheLevel >= 0) {
listenerContainer.setCacheLevel(cacheLevel);
} else if (cacheLevelName != null) {
listenerContainer.setCacheLevelName(cacheLevelName);
} else {
// Default to CACHE_CONSUMER unless specified. This works best
// with most JMS providers.
listenerContainer.setCacheLevel(DefaultMessageListenerContainer.CACHE_CONSUMER);
}
if (idleTaskExecutionLimit >= 0) {
listenerContainer.setIdleTaskExecutionLimit(idleTaskExecutionLimit);
}
if (maxConcurrentConsumers >= 0) {
listenerContainer.setMaxConcurrentConsumers(maxConcurrentConsumers);
}
if (maxMessagesPerTask >= 0) {
listenerContainer.setMaxMessagesPerTask(maxMessagesPerTask);
}
listenerContainer.setPubSubNoLocal(pubSubNoLocal);
if (receiveTimeout >= 0) {
listenerContainer.setReceiveTimeout(receiveTimeout);
}
if (recoveryInterval >= 0) {
listenerContainer.setRecoveryInterval(recoveryInterval);
}
if (taskExecutor != null) {
listenerContainer.setTaskExecutor(taskExecutor);
}
if (transactionManager != null) {
listenerContainer.setTransactionManager(transactionManager);
}
if (transactionName != null) {
listenerContainer.setTransactionName(transactionName);
}
if (transactionTimeout >= 0) {
listenerContainer.setTransactionTimeout(transactionTimeout);
}
} else if (container instanceof ServerSessionMessageListenerContainer) {
// this includes ServerSessionMessageListenerContainer102
ServerSessionMessageListenerContainer listenerContainer = (ServerSessionMessageListenerContainer)container;
if (maxMessagesPerTask >= 0) {
listenerContainer.setMaxMessagesPerTask(maxMessagesPerTask);
}
if (serverSessionFactory != null) {
listenerContainer.setServerSessionFactory(serverSessionFactory);
}
} else if (container instanceof SimpleMessageListenerContainer) {
// this includes SimpleMessageListenerContainer102
SimpleMessageListenerContainer listenerContainer = (SimpleMessageListenerContainer)container;
if (concurrentConsumers >= 0) {
listenerContainer.setConcurrentConsumers(concurrentConsumers);
}
listenerContainer.setPubSubNoLocal(pubSubNoLocal);
if (taskExecutor != null) {
listenerContainer.setTaskExecutor(taskExecutor);
}
}
}