Taking input from multiple files to a camel route

Solution 1:

Yes you can use poll-enrich to call consumer-endpoints like file to enrich the message. This works for many other consumer-endpoints as well like SFTP or message queues.

If you need to read same file multiple times it can get trickier as you'll likely have to set noop=true and possibly use something like dummy idempotent repository to get around camels default behavior.

Note that calling pollEnrich seems to clear headers / create new message so use exchange properties to persist data between pollEnrich calls.

from("file:someDirectory")
    .setProperty("file1").body()
    .pollEnrich("file:otherDirectory", 3000)
    .setProperty("file2").body()
    .pollEnrich("file:yetAnotherDirectory", 3000)
    .setProperty("file3").body();