I'd like to share my workaround in case anybody is interested (using Camel 
2.11.0):
 
I was successful with the following approach:

        camelContext.stopRoute( "my-file-route", 30, SECONDS );
        camelContext.removeRoute( "my-file-route" );
        MyPollingRoutes newRoutes = new MyPollingRoutes( newPollDir );
        camelContext.addRoutes( newRoutes );

MyPollingRoutes extends RouteBuilder and in configure() I do something like:

        from( "file://" + this.pollDir + "?antInclude=*.xml" ).routeId( 
"my-file-route" )
                .to( ... );

This simply stops the existing route and replaces it with a new one (using a 
different path) during runtime.

It is necessary to create and add a new instance of MyPollingRoutes instead of 
just changing the pollDir member, since Camel wouldn't call configure() again 
after re-adding it to the context.

Reply via email to