I'm reading files line by line using FileSplitter, and then filter some of the corrupted lines - as to discard some lines - in order to do webservices calls for each line.
What I need to do in addition to this is to get the file moved to completed files directory.
Update: Just to be more clear, the successful/good lines after filtering will need to be aggregated in a file to be written to the completed directory and the corrupted/filtered lines will be written to another one.
Mentioning the above, I was not clear about the following points:
The scenario simply looks like:
FileSplitter -> line Filter -> Outbound Gateway (webservices) -> Aggregator
The FileSplitter
can be configured to emit FileSplitter.FileMarker
as the first message with the FileSplitter.FileMarker.Mark.START
and in the end with the FileSplitter.FileMarker.Mark.END
respectively.
You can add a router (PayloadTypeRouter
should be enough) after splitter to handle FileSplitter.FileMarker
in a different flow. And if it is a FileSplitter.FileMarker.Mark.END
you just perform a desired logic to move to the completed directory.
I don't think that you need an aggregator for this scenario.
Anyway the FileSplitter
can be configured with the setApplySequence(true)
to be able to correlate a group downstream in the aggregator. But you still won't be able to know the size of the group to release it in time. The FileSplitter.FileMarker.Mark.END
still can help here, although I don't see the reason in that for your task.
There is some info on the matter in the Reference Manual.