Hello Camel Gurus,

I’m trying to process all the files in the directory using the routes below.
File processing is triggered by the user.

The problem I’ve faced is the following: when an exception happens during files 
processing, all the files are considered to be failed (even if some of them 
were processed successfully), because the dynamicRouter works with a single 
exchange and the file component sets up the onCompletion trigger on that 
exchange.

Is there any way to send a new exchange to the route2 (see below) so that each 
file obtained by pollEnrich (in the route2) was processed separately?

Here is the route:

<camelContext>
    <route id=”route1”>
        <from uri="direct:start"/>
        <setBody>
            <constant>Tick</constant>
        </setBody>
        <dynamicRouter>
            <spel>#{request?.body == null ? null : "direct:getFiles"}</spel>
        </dynamicRouter>
    </route>
    <route id=”route2”>
        <from uri="direct:getFiles"/>
        <pollEnrich uri="file:/path/to/file" timeout="5000" />
        <filter>
            <spel>#{request?.body != null}</spel>
            <to uri=”bean:processFile”/>
        </filter>
    </route>
</camelContext>


Best Regards,
Sergey


_______________________________________________________
CONFIDENTIALITY NOTICE: This email and any files attached to it may be 
confidential. If you are not the intended recipient you are notified that 
using, copying, distributing or taking any action in reliance on the contents 
of this information is strictly prohibited. If you have received this email in 
error please notify the sender and delete this email. 

Reply via email to