How do we read all the files from a directory as a single Message<List<File>>
? The usecase is to send a status report by iterating all the files and reading their filenames as a single message.
Please share some guidance if a custom MessageSource
has to be implemented. Thanks
Yes. The MessageSource
could be a simple as this:
IntegrationFlow.fromSupplier(() -> new File("myDir").list())
Then you need to play with an appropriate trigger for the poller when you would like to list those file names.
You also can do this as a part of a handle()
as a reaction to some incoming event, e.g. you ask for those names from some user call.