Can I use Spring Integration as a daemon in order to poll a directory?

daemon, polling, spring, spring-integration

Solution

All you need is to have a main method (or a WAR file if you want to deploy to Tomcat or another servlet container) that creates a Spring ApplicationContext (e.g. new ClassPathXmlApplicationContext("file-poller.xml"))

It can run with a cron trigger, fixed-rate or fixed-delay trigger.

JMX operations can be exposed on Spring Integration's File adapter (or any adapter) by simply adding a single config element (e.g. <mbean-export>).

Bottom line: you REALLY do not need an ESB if you simply want a File poller to run continuously. You can have a single small config file and one line of code in a main method.

Visit the samples for more info: https://github.com/springsource/spring-integration-samples (look under basic/file specifically)

Hope that helps, Mark

Problem

I am new to Spring Integration and I am considering using it in order to poll a directory for new files in order to process those files. My question is: is Spring Integration some sort of daemon one can launch and that one can use in order to poll a directory? Is this is possible can someone please direct me to relevant section of the official documentation on how to launch Spring Integration?

Original source

Related problems