I want to setup an integration flow like this:
return IntegrationFlows
.from("inputChannel")
.split(fileSplitter)
.handle(this::doStuff1)
.handle(this::doStuff2)
.handle(this::doStuff3)
.aggregate()
.handle(this::deleteFile)
FileSplitter:
@Bean
public FileSplitter fileSplitter() {
FileSplitter fileSplitter = new FileSplitter(true, true);
fileSplitter.setCharset(StandardCharsets.UTF_8);
fileSplitter.setApplySequence(true);
return fileSplitter;
}
Input is of type File
. The file size is big, so I want to stream the contents line by line, process them and delete the file at the end. The problem is now I have to check and ignore the file SOF,EOF marker payloads in all the handler methods along the chain. Is there a different way without checking the types in each doStuff methods? (I think advises will might be useful but haven't tried them yet)