{"id":58577,"date":"2016-07-21T16:00:08","date_gmt":"2016-07-21T13:00:08","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=58577"},"modified":"2016-07-20T18:16:26","modified_gmt":"2016-07-20T15:16:26","slug":"spring-integration-polling-file-creation-modification","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2016\/07\/spring-integration-polling-file-creation-modification.html","title":{"rendered":"Spring Integration &#8211; Polling file creation and modification"},"content":{"rendered":"<h2>1 Introduction<\/h2>\n<p>File support is another of Spring Integration&#8217;s endpoints to communicate with external systems. In this case, it provides several components to read, write and transform files. During this post, we are going to write an application which monitors a directory in order to read all files in there. In concrete it does the following:<\/p>\n<ul>\n<li>When the application starts, it reads all files present in the directory.<\/li>\n<li>The application will then keep an eye on the directory to detect new files and existing files which have been modified.<\/li>\n<\/ul>\n<p>The source code can be found in\u00a0<a href=\"https:\/\/github.com\/xpadro\/spring-integration\/tree\/master\/file\">Github<\/a>.<\/p>\n<h2>2 Configuration<\/h2>\n<p>The application is built with Spring Boot, since it eases configuration significantly. To create the initial infrastructure of the application, you can go to\u00a0<a href=\"https:\/\/start.spring.io\/\">https:\/\/start.spring.io\/<\/a>, select the Integration module and generate the project. Then you can open the zip file in your favourite IDE.<\/p>\n<p>I added a couple of dependencies to the pom.xml like commons.io or Spring Integration Java DSL. My pom.xml file looks like as follows:<\/p>\n<pre class=\"brush:xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\r\n         xsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt;\r\n  &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\r\n\r\n  &lt;groupId&gt;xpadro.spring.integration&lt;\/groupId&gt;\r\n  &lt;artifactId&gt;file-read-directory&lt;\/artifactId&gt;\r\n  &lt;version&gt;0.0.1-SNAPSHOT&lt;\/version&gt;\r\n  &lt;packaging&gt;jar&lt;\/packaging&gt;\r\n\r\n  &lt;name&gt;file-read-directory&lt;\/name&gt;\r\n  &lt;description&gt;Demo project for Spring Boot&lt;\/description&gt;\r\n\r\n  &lt;parent&gt;\r\n    &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n    &lt;artifactId&gt;spring-boot-starter-parent&lt;\/artifactId&gt;\r\n    &lt;version&gt;1.3.5.RELEASE&lt;\/version&gt;\r\n    &lt;relativePath\/&gt; &lt;!-- lookup parent from repository --&gt;\r\n  &lt;\/parent&gt;\r\n\r\n  &lt;properties&gt;\r\n    &lt;project.build.sourceEncoding&gt;UTF-8&lt;\/project.build.sourceEncoding&gt;\r\n    &lt;java.version&gt;1.8&lt;\/java.version&gt;\r\n  &lt;\/properties&gt;\r\n\r\n  &lt;dependencies&gt;\r\n    &lt;dependency&gt;\r\n      &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n      &lt;artifactId&gt;spring-boot-starter-integration&lt;\/artifactId&gt;\r\n    &lt;\/dependency&gt;\r\n\r\n    &lt;dependency&gt;\r\n      &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n      &lt;artifactId&gt;spring-boot-starter-test&lt;\/artifactId&gt;\r\n      &lt;scope&gt;test&lt;\/scope&gt;\r\n    &lt;\/dependency&gt;\r\n\r\n    &lt;!-- Spring Integration - Java DSL --&gt;\r\n    &lt;dependency&gt;\r\n      &lt;groupId&gt;org.springframework.integration&lt;\/groupId&gt;\r\n      &lt;artifactId&gt;spring-integration-java-dsl&lt;\/artifactId&gt;\r\n      &lt;version&gt;1.0.0.RELEASE&lt;\/version&gt;\r\n    &lt;\/dependency&gt;\r\n\r\n    &lt;dependency&gt;\r\n      &lt;groupId&gt;commons-io&lt;\/groupId&gt;\r\n      &lt;artifactId&gt;commons-io&lt;\/artifactId&gt;\r\n      &lt;version&gt;2.5&lt;\/version&gt;\r\n    &lt;\/dependency&gt;\r\n\r\n  &lt;\/dependencies&gt;\r\n\r\n  &lt;build&gt;\r\n    &lt;plugins&gt;\r\n      &lt;plugin&gt;\r\n        &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n        &lt;artifactId&gt;spring-boot-maven-plugin&lt;\/artifactId&gt;\r\n      &lt;\/plugin&gt;\r\n    &lt;\/plugins&gt;\r\n  &lt;\/build&gt;\r\n\r\n&lt;\/project&gt;<\/pre>\n<p>The starting point is FileReadDirectoryApplication:<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\"brush:java\">@SpringBootApplication\r\npublic class FileReadDirectoryApplication {\r\n\r\n    public static void main(String[] args) throws IOException, InterruptedException {\r\n\t\tSpringApplication.run(FileReadDirectoryApplication.class, args);\r\n\t}\r\n}<\/pre>\n<p>Starting from here, we are going to add the Spring Integration components for reading from a specific folder of the filesystem.<\/p>\n<h2>3 Adding the adapter<\/h2>\n<p>In order to read from the file system, we need an inbound channel adapter. The adapter is a file reading message source, which is responsible of polling the file system directory for files and create a message from each file it finds.<\/p>\n<pre class=\"brush:java\">@Bean\r\n@InboundChannelAdapter(value = \"fileInputChannel\", poller = @Poller(fixedDelay = \"1000\"))\r\npublic MessageSource&lt;File&gt; fileReadingMessageSource() {\r\n    CompositeFileListFilter&lt;File&gt; filters = new CompositeFileListFilter&lt;&gt;();\r\n    filters.addFilter(new SimplePatternFileListFilter(\"*.txt\"));\r\n    filters.addFilter(new LastModifiedFileFilter());\r\n    \r\n    FileReadingMessageSource source = new FileReadingMessageSource();\r\n    source.setAutoCreateDirectory(true);\r\n    source.setDirectory(new File(DIRECTORY));\r\n    source.setFilter(filters);\r\n    \r\n    return source;\r\n}<\/pre>\n<p>We can prevent some types of files from being polled by setting a list of filters to the message source. For this example two filters have been included:<\/p>\n<ul>\n<li><i>SimplePatternFileListFilter<\/i>: Filter provided by Spring. Only files with the specified extension will be polled. In this case, only text files will be accepted.<\/li>\n<li><i>LastModifiedFileFilter<\/i>: Custom filter. This filter keeps track of already polled files and will filter out files not modified since the last time it was tracked.<\/li>\n<\/ul>\n<h2>4 Processing the files<\/h2>\n<p>For each polled file, we will transform its content to String before passing it to the processor. For this purpose, Spring already provides a component:<\/p>\n<pre class=\"brush:java\">@Bean\r\npublic FileToStringTransformer fileToStringTransformer() {\r\n    return new FileToStringTransformer();\r\n}<\/pre>\n<p>Hence, instead of receiving a Message&lt;File&gt;, the processor will receive a Message&lt;String&gt;. The file processor is our custom component which will do something as advanced as printing the file content:<\/p>\n<pre class=\"brush:java\">public class FileProcessor {\r\n    private static final String HEADER_FILE_NAME = \"file_name\";\r\n    private static final String MSG = \"%s received. Content: %s\";\r\n    \r\n    public void process(Message&lt;String&gt; msg) {\r\n        String fileName = (String) msg.getHeaders().get(HEADER_FILE_NAME);\r\n        String content = msg.getPayload();\r\n        \r\n        System.out.println(String.format(MSG, fileName, content));\r\n    }\r\n}<\/pre>\n<h2>5 Building the flow<\/h2>\n<p>Now that we have all the required components in place, let&#8217;s build the flow. We are using Spring Integration Java DSL, since it makes the flow more readable:<\/p>\n<pre class=\"brush:java\">@Bean\r\npublic IntegrationFlow processFileFlow() {\r\n    return IntegrationFlows\r\n        .from(\"fileInputChannel\")\r\n        .transform(fileToStringTransformer())\r\n        .handle(\"fileProcessor\", \"process\").get();\r\n    }\r\n    \r\n    @Bean\r\n    public MessageChannel fileInputChannel() {\r\n        return new DirectChannel();\r\n    }<\/pre>\n<h2>6 Running the application<\/h2>\n<p>In my directory, I already have a file called &#8216;previousFile.txt&#8217;. After starting the application, we will create two files and modify one of them.<\/p>\n<pre class=\"brush:java\">public static void main(String[] args) throws IOException, InterruptedException {\r\n    SpringApplication.run(FileReadDirectoryApplication.class, args);\r\n    createFiles();\r\n}\r\n\r\nprivate static void createFiles() throws IOException, InterruptedException {\r\n    createFile(\"file1.txt\", \"content\");\r\n    createFile(\"file2.txt\", \"another file\");\r\n    appendFile(\"file1.txt\", \" modified\");\r\n}<\/pre>\n<p>If we run the application, we should see the following print statements:<\/p>\n<pre class=\"brush:bash\">previousFile.txt received. Content: previous content\r\nfile1.txt received. Content: content\r\nfile2.txt received. Content: another file\r\nfile1.txt received. Content: content modified<\/pre>\n<h2>7 Conclusion<\/h2>\n<p>This example shows how simple it is to read files from a directory using Spring Integration, obviously with the help of Spring Boot to simplify the configuration. Depending on your needs, you can add your own custom filters to the message source, or use another one of the provided by Spring, like the\u00a0<a href=\"http:\/\/docs.spring.io\/spring-integration\/api\/org\/springframework\/integration\/file\/filters\/RegexPatternFileListFilter.html\">RegexPatternFileListFilter<\/a>. You can check for other implementations\u00a0<a href=\"http:\/\/docs.spring.io\/spring-integration\/api\/org\/springframework\/integration\/file\/filters\/FileListFilter.html\">here<\/a>.<\/p>\n<p>If you found this post useful, please share it or star my repository :)<\/p>\n<p>I&#8217;m publishing my new posts on Google plus and Twitter. Follow me if you want to be updated with new content.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"http:\/\/xpadro.blogspot.com\/2016\/07\/spring-integration-polling-file.html\">Spring Integration &#8211; Polling file creation and modification<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/join-us\/jcg\/\">JCG partner<\/a> Xavier Padro at the <a href=\"http:\/\/xpadro.blogspot.com\/\">Xavier Padr\u00f3&#8217;s Blog<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>1 Introduction File support is another of Spring Integration&#8217;s endpoints to communicate with external systems. In this case, it provides several components to read, write and transform files. During this post, we are going to write an application which monitors a directory in order to read all files in there. In concrete it does the &hellip;<\/p>\n","protected":false},"author":533,"featured_media":240,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[30,410],"class_list":["post-58577","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-spring","tag-spring-integration"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Spring Integration - Polling file creation and modification - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"1 Introduction File support is another of Spring Integration&#039;s endpoints to communicate with external systems. In this case, it provides several\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2016\/07\/spring-integration-polling-file-creation-modification.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring Integration - Polling file creation and modification - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"1 Introduction File support is another of Spring Integration&#039;s endpoints to communicate with external systems. In this case, it provides several\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2016\/07\/spring-integration-polling-file-creation-modification.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2016-07-21T13:00:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Xavier Padro\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/xavips\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Xavier Padro\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/07\\\/spring-integration-polling-file-creation-modification.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/07\\\/spring-integration-polling-file-creation-modification.html\"},\"author\":{\"name\":\"Xavier Padro\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/5443fbc8fb815652f181942d4622090d\"},\"headline\":\"Spring Integration &#8211; Polling file creation and modification\",\"datePublished\":\"2016-07-21T13:00:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/07\\\/spring-integration-polling-file-creation-modification.html\"},\"wordCount\":581,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/07\\\/spring-integration-polling-file-creation-modification.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"keywords\":[\"Spring\",\"Spring Integration\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/07\\\/spring-integration-polling-file-creation-modification.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/07\\\/spring-integration-polling-file-creation-modification.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/07\\\/spring-integration-polling-file-creation-modification.html\",\"name\":\"Spring Integration - Polling file creation and modification - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/07\\\/spring-integration-polling-file-creation-modification.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/07\\\/spring-integration-polling-file-creation-modification.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"datePublished\":\"2016-07-21T13:00:08+00:00\",\"description\":\"1 Introduction File support is another of Spring Integration's endpoints to communicate with external systems. In this case, it provides several\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/07\\\/spring-integration-polling-file-creation-modification.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/07\\\/spring-integration-polling-file-creation-modification.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/07\\\/spring-integration-polling-file-creation-modification.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"spring-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2016\\\/07\\\/spring-integration-polling-file-creation-modification.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Spring Integration &#8211; Polling file creation and modification\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/5443fbc8fb815652f181942d4622090d\",\"name\":\"Xavier Padro\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bbf0579a188773b88762d54dadc779b2cd17ddb261d809956ed55d8569bd7ca2?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bbf0579a188773b88762d54dadc779b2cd17ddb261d809956ed55d8569bd7ca2?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/bbf0579a188773b88762d54dadc779b2cd17ddb261d809956ed55d8569bd7ca2?s=96&d=mm&r=g\",\"caption\":\"Xavier Padro\"},\"description\":\"Xavier is a software developer working in a consulting firm based in Barcelona. He is specialized in web application development with experience in both frontend and backend. He is interested in everything related to Java and the Spring framework.\",\"sameAs\":[\"http:\\\/\\\/xpadro.blogspot.gr\\\/\",\"http:\\\/\\\/linkedin.com\\\/pub\\\/xavier-padro-sobrepera\\\/1a\\\/64\\\/3\\\/en\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/xavips\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/xavier-padro\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Spring Integration - Polling file creation and modification - Java Code Geeks","description":"1 Introduction File support is another of Spring Integration's endpoints to communicate with external systems. In this case, it provides several","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2016\/07\/spring-integration-polling-file-creation-modification.html","og_locale":"en_US","og_type":"article","og_title":"Spring Integration - Polling file creation and modification - Java Code Geeks","og_description":"1 Introduction File support is another of Spring Integration's endpoints to communicate with external systems. In this case, it provides several","og_url":"https:\/\/www.javacodegeeks.com\/2016\/07\/spring-integration-polling-file-creation-modification.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2016-07-21T13:00:08+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","type":"image\/jpeg"}],"author":"Xavier Padro","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/xavips","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Xavier Padro","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2016\/07\/spring-integration-polling-file-creation-modification.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/07\/spring-integration-polling-file-creation-modification.html"},"author":{"name":"Xavier Padro","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/5443fbc8fb815652f181942d4622090d"},"headline":"Spring Integration &#8211; Polling file creation and modification","datePublished":"2016-07-21T13:00:08+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/07\/spring-integration-polling-file-creation-modification.html"},"wordCount":581,"commentCount":3,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/07\/spring-integration-polling-file-creation-modification.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","keywords":["Spring","Spring Integration"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2016\/07\/spring-integration-polling-file-creation-modification.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2016\/07\/spring-integration-polling-file-creation-modification.html","url":"https:\/\/www.javacodegeeks.com\/2016\/07\/spring-integration-polling-file-creation-modification.html","name":"Spring Integration - Polling file creation and modification - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/07\/spring-integration-polling-file-creation-modification.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/07\/spring-integration-polling-file-creation-modification.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","datePublished":"2016-07-21T13:00:08+00:00","description":"1 Introduction File support is another of Spring Integration's endpoints to communicate with external systems. In this case, it provides several","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2016\/07\/spring-integration-polling-file-creation-modification.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2016\/07\/spring-integration-polling-file-creation-modification.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2016\/07\/spring-integration-polling-file-creation-modification.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","width":150,"height":150,"caption":"spring-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2016\/07\/spring-integration-polling-file-creation-modification.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Spring Integration &#8211; Polling file creation and modification"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/5443fbc8fb815652f181942d4622090d","name":"Xavier Padro","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/bbf0579a188773b88762d54dadc779b2cd17ddb261d809956ed55d8569bd7ca2?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/bbf0579a188773b88762d54dadc779b2cd17ddb261d809956ed55d8569bd7ca2?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/bbf0579a188773b88762d54dadc779b2cd17ddb261d809956ed55d8569bd7ca2?s=96&d=mm&r=g","caption":"Xavier Padro"},"description":"Xavier is a software developer working in a consulting firm based in Barcelona. He is specialized in web application development with experience in both frontend and backend. He is interested in everything related to Java and the Spring framework.","sameAs":["http:\/\/xpadro.blogspot.gr\/","http:\/\/linkedin.com\/pub\/xavier-padro-sobrepera\/1a\/64\/3\/en","https:\/\/x.com\/https:\/\/twitter.com\/xavips"],"url":"https:\/\/www.javacodegeeks.com\/author\/xavier-padro"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/58577","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/533"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=58577"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/58577\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/240"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=58577"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=58577"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=58577"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}