I am new to File Integration. We are using Spring+SpringBatch to poll a file and process the file . This used to work for sometime and now we see issues with it.
Below is my code
As soon as I copy a file to configured landingZone , the file moves to archived location but do not trigger the job to process the file .Not sure what's happening and I am clueless about where to start .Does the ServiceActivator performs any kind of caching of previous tasksCode:<bean id="masterTrigger" class="org.springframework.scheduling.support.PeriodicTrigger"> <constructor-arg value="10" /> <property name="fixedRate" value="true" /> </bean> <!-- GCA Audit Records File Poller Starts --> <file:inbound-channel-adapter channel="fileIn" directory="/home/tranftp/gca/auditrecords/gca/" filename-regex="(?i)(RTS).*.IDX" prevent-duplicates="false"> <int:poller trigger="masterTrigger" /> </file:inbound-channel-adapter> <int:service-activator input-channel="fileIn" ref="inboundFileProcessor" /> <bean id="inboundFileProcessor" class="com.test.batch.integration.InboundFileProcessor"> <property name="jobLauncher" ref="jobLauncher" /> <property name="jobRegistry" ref="jobRegistry" /> <property name="fileToJobMap"> <map> <entry key="(?i)(RTS).*.IDX"> <list> <value>gcaAuditBatchJob</value> <value>/home/tranftp/BatchFiles/gca/</value> </list> </entry> </map> </property> </bean>
Below is the ServiceActivator code .
We do not see any exceptions in logsCode:@ServiceActivator public void onNewFileArrival( @Headers Map<String, Object> headers, @Payload File file) throws Exception { String filePath = file.getAbsolutePath(); Date fileLastModified = new Date(file.lastModified()); long fileSize = file.length() / 1000; logger.info("A new file has arrived at: " + filePath + ", last modified: " + fileLastModified + ", size: " + fileSize + "KB"); String jobName = null; String destPath = null; for(String key:fileToJobMap.keySet()) { if(file.getName().matches(key)) { jobName = fileToJobMap.get(key).get(0); destPath = fileToJobMap.get(key).get(1); break; } } if(jobName != null && destPath != null) { logger.info("destPath: " + destPath); // File Monitoring FileMonitoring fileMonitoring = new FileMonitoring(); fileMonitoring.setFileName(filePath); fileMonitoring.setFileTime(fileLastModified); fileMonitoring.setFileStatus(FileMonitoring.FILE_STATUS_RECEIVED); fileMonitoring.setJobName(jobName); destPath = FTPUtil.archiveFile(filePath, destPath, "yyMMddHHmmss", false, true); fileMonitoring.setDestPath(destPath); logger.info("Kicking off job: " + jobName + " with file: " + destPath); Job job = jobRegistry.getJob(jobName); JobParameters jobParameters = new JobParametersBuilder().addDate("schedule.time", DateUtil.getAppDate()).toJobParameters(); jobParameters = new JobParametersBuilder(jobParameters).addString("fileName", destPath).toJobParameters(); JobExecution jobExec = jobLauncher.run(job, jobParameters);
Its extremely Urgent , help appreciated .


Reply With Quote