Hi all, I am implementing/developing a route that needs to load files from remote sites. In the first step I have a <choice > on the body to check which endpoint and regex has to be used to load the files. e.g.
<choice id="type"> <when> <simple>${body} range '0..9'</simple> <to uri="direct:loadSvgFiles"/> </when> <when> <simple>${body} range '20..29'</simple> <to uri="direct:loadXmlFiles"/> </when> ... </choice> In the next step I have to load a couple of files from the endpoint. As there may be quite a lot of svg/xml files and I only need one type each time the route is run, I start only the route, that gets the file with "direct:load**Files". And that is where i am stuck (ftpUrl is my ftp endpoint string with &include=&include=.*svg$" to include all svg files) If I use .from(ftpUrl) .aggregate().constant(true).completionFromBatchConsumer() ... All Files are loaded and aggregated, but that happens every time the route is started. With .from("direct:loadSvgFiles") .pollEnrich(ftpUrl, timeout=1000l) I get files, until timeout is reached. Setting timeout to -1, the route loads all files but failes to stop, if the ftp server is unreachable. What i need is kind of a merge of pollEnrich and aggregate. e.g. load the first file with a timeout and then aggregate all files that are mached by the regex. Or pollEnrich that failes after n connection errors in a row and loads all files. Any help would be great cheers clemens