spring-integration icon indicating copy to clipboard operation
spring-integration copied to clipboard

.ok file awareness in FileWritingMessageHandler and FileReadingMessageSource [INT-3046]

Open spring-operator opened this issue 12 years ago • 1 comments

Mohammed Saleem Padinharkkara opened INT-3046 and commented

While writing/reading large files, we typically wait for a ".ok" file to begin processing. When using Spring Integration, we can use the temporary suffix to ensure that the file will be complete at the time of reading, but in real world situations where we are processing files generated by different systems, we are left to write a chain of handlers to look for the .ok file and then process the actual file.

Ideally the framework should have this as a built in property, something called triggerFile for both FileWritingMessageHandler and FileReadingMessageSource, which will look for the triggerFile in the same directory before it continues with the current functionality.

For eg:

<int-file:inbound-channel-adapter id="wssConfirmationsOK" filename-pattern="murexTradeConfirmation*.xml" triggerFileExtension="ok" directory="file:${confirmations.directory}">
	<int:poller id="poller" fixed-rate="30000"
		max-messages-per-poll="10" />
	</int-file:inbound-channel-adapter>
<int-file:outbound-channel-adapter channel="generatedTdmls" directory="file:${tdmls.directory}" triggerFileExtension="ok"/>

Affects: 2.2.3

1 votes, 3 watchers

spring-operator avatar Jun 04 '13 20:06 spring-operator

Gary Russell commented

You can achieve this more simply with a custom FileListFilter. Simply have the filter block any files where the equivalent .ok file is not present. Of course, the filter would not return the .ok file itself.

You are not allowed a filter attribute with a *-pattern so you'd use a CompositeFileListFilter which wraps a SimplePatternFileListFilter and your custom OnlyFilesWithMatchingDotOkFileListFilter.

If you would like to contribute a generic version of your custom filter to the framework, see https://github.com/SpringSource/spring-integration/blob/master/CONTRIBUTING.md

spring-operator avatar Jun 05 '13 06:06 spring-operator