Added support for "taskExecutor" on the @Poller annotation. This requires a reference to a TaskExecutor instance resolvable by bean name (INT-409).
This commit is contained in:
@@ -49,6 +49,8 @@ public @interface Poller {
|
||||
|
||||
int maxMessagesPerPoll() default -1;
|
||||
|
||||
String taskExecutor() default "";
|
||||
|
||||
Transactional transactionAttributes() default @Transactional;
|
||||
|
||||
String transactionManager() default "";
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.util.List;
|
||||
import org.aopalliance.aop.Advice;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.integration.annotation.Poller;
|
||||
import org.springframework.integration.endpoint.AbstractPollingEndpoint;
|
||||
import org.springframework.integration.scheduling.IntervalTrigger;
|
||||
@@ -57,6 +58,13 @@ public abstract class AnnotationConfigUtils {
|
||||
Transactional txAnnotation = pollerAnnotation.transactionAttributes();
|
||||
endpoint.setTransactionDefinition(parseTransactionAnnotation(txAnnotation));
|
||||
}
|
||||
if (StringUtils.hasText(pollerAnnotation.taskExecutor())) {
|
||||
String taskExecutorRef = pollerAnnotation.taskExecutor();
|
||||
Assert.isTrue(beanFactory.containsBean(taskExecutorRef),
|
||||
"failed to resolve taskExecutor reference, no such bean '" + taskExecutorRef + "'");
|
||||
TaskExecutor taskExecutor = (TaskExecutor) beanFactory.getBean(taskExecutorRef, TaskExecutor.class);
|
||||
endpoint.setTaskExecutor(taskExecutor);
|
||||
}
|
||||
String[] adviceChainArray = pollerAnnotation.adviceChain();
|
||||
if (adviceChainArray.length > 0) {
|
||||
List<Advice> adviceChain = new ArrayList<Advice>();
|
||||
|
||||
Reference in New Issue
Block a user