container.setMessageSelector(endpoint.getSelector());
}
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 {
listenerContainer.setCacheLevel(defaultCacheLevel(endpoint));
}
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);
}
PlatformTransactionManager tm = getTransactionManager();
if (tm != null && transacted) {
listenerContainer.setTransactionManager(tm);
} else if (transacted) {
throw new IllegalArgumentException("Property transacted is enabled but a transactionManager was not injected!");
}
if (transactionName != null) {
listenerContainer.setTransactionName(transactionName);
}
if (transactionTimeout >= 0) {
listenerContainer.setTransactionTimeout(transactionTimeout);
}
} 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);
}
}
}