I have an Inbound File Channel Adapter with the auto-startup property set to false. This adapter is the starting point for my application; if it sends no messages notifying the system of files, I expect everything else to be inert.
However, upon starting my context, messages start flowing through the system. Why?
Config:
<int-file:inbound-channel-adapter auto-startup="false" id="fileWatcher" directory="${input.dir}" channel="incomingFiles">
<int:poller fixed-rate="1000"></int:poller>
</int-file:inbound-channel-adapter>
<int:channel id="incomingFiles"></int:channel>
Main method:
public static void main(String[] args) {
logger.info("Started application");
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:/spring-config/*.xml");
context.start();
}
Logs:
[...]
12:06:56.743 [main] INFO o.s.i.e.SourcePollingChannelAdapter - started fileWatcher
12:06:56.770 [task-scheduler-6] INFO o.s.i.file.FileReadingMessageSource - Created message: [[Payload=C:\input\From Spreadsheet.txt][Headers={timestamp=1343214416770, id=b8e92486-d469-406e-8787-df78e23b287a}]]
set auto-startup=”false” on the adapter (it is true by default).
You can manually start it getting a reference to it and call fileWatcher.start(). This is also available over JMX if you include the integration MBean exporter.
Or, you can send a message to a <control-bus /> containing ‘@fileWatcher.start()’ in its payload.
Oh; I just noticed you have it already.
DON’T call context.start() – that will start all the beans, regardless of their auto-startup setting.
auto-startups controls, err, AUTO startup – you are manually starting the context.