what I would like to do is to track the files removed and apply certain logic around this (get the id and update the entities). I've found that we can pass a list of watch events inside the channel adapter including
FileReadingMessageSource.WatchEventType.DELETE
but when I remove the file from the folder I do not see any events triggered and the transformer is never being applied
@Bean
public IntegrationFlow integrationFlow(FileToMovieTransformer fileToMovieTransformer) {
return this.integrationFlowBuilder()
.transform(fileToMovieTransformer)
.channel(movieHandlerChannel())
.get();
}
private IntegrationFlowBuilder integrationFlowBuilder() {
return IntegrationFlows.from(
Files.inboundAdapter(new File(localFilmFolder))
.autoCreateDirectory(true)
.useWatchService(true)
.watchEvents(FileReadingMessageSource.WatchEventType.CREATE, FileReadingMessageSource.WatchEventType.DELETE)
.patternFilter("*.xml"),
e -> e.poller(Pollers.fixedDelay(10, TimeUnit.SECONDS)
));
}