I am trying to configure below workflow all in annotations
Inbound channel adapter with poller (cron trigger) scheduled to run every 30 minutes Poll the file form directory i.e. 10 files and move to stage directory For each file need to invoke a batch job in parallel i.e. 10 Jobs should run in parallel with the different files polled
I am able to achieve everything but unable to configure downstream executor channel to run jobs in parallel.
Below is the reference implementation. Eveyrything is working i.e. job is launched file after the file but it needs to launch job for different files in parallel Appreciate for any help on this
@InboundChannelAdapter (incoming channel, custompoller)
public MessageSource<File> pollFile ( Directory Scanner) {
}
public PollerMetadata custompoller(errorhandler) {
poller.trigger(cron for every 10 minutes)
}
@ServiceActivator(incoming channel)
public MessageHandler filewritertotempdiretory() {
outputchannel(tempdirchannel)
}
@ServiceActivator(inputChannel = tempdirchannel)
public MessageHandler tempdirfilehandler() {
MethodInvokingMessageHandler messageHandler = (launcher class, "methodname");
return messageHandler;
}
Poller Metadata. Read in some other SO that we should not put the task executor when setting poller on cron, is that true ?
also how can i make the messages polled (say 10 messages polled) execute in parallel i.e. add task executor in poller metadata
@Bean
public PollerMetadata preProcessPoller(MessagePublishingErrorHandler errorHandler) {
PollerMetadata poller = new PollerMetadata();
poller.setTrigger(new CronTrigger("0/15 * * * * ?"));
poller.setMaxMessagesPerPoll(Long.valueOf(maxMessagesPerPoll));
errorHandler.setDefaultErrorChannel(errorChannel());
poller.setErrorHandler(errorHandler);
return poller;
}