hello, 

I have defined a route & route Policy class
<route shutdownRunningTask="CompleteCurrentTaskOnly" id="UserCSVToDB" 
routePolicyRef="myPolicy">
                    <from
uri="file:///C:\FS\processing\?readLock=true&amp;move=C:\FS\complete\&amp;charset=utf-8"/>
              <delay><constant>1000</constant></delay>
                      <setHeader headerName="sourcename">
                        <simple>DS</simple>
              </setHeader>
             <choice>
                        <when>
                        <simple>${body} != null</simple>
                         <split streaming="true">
                                      <tokenize token="\n"></tokenize>
                                      <unmarshal>
                                        <csv/>
                                      </unmarshal>
                                      <log message="The message contains 
${body}"/>
                                    </split>
                                    <to
uri="bean:monitorbean?method=updateSequence(${header.sourcename},${header.CamelFileName})"/>
                        </when>
            </choice>  
    </route>

My CustomRoute Policy class
public class CustomRoutePolicy extends RoutePolicySupport{

    @Override
    public void onExchangeDone(Route route, Exchange exchange) {
        CamelContext context = exchange.getContext();
        String stop = route.getId();
        try {
            context.getInflightRepository().remove(exchange);
            context.stopRoute(stop);
        } catch (Exception e) {
            // let the exception handle handle it, which is often just to log it
            getExceptionHandler().handleException("Error Stopping route", e);
        }

    }

}


Problem is that it does not stop route and i see below in the logs.

[el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy        INFO 
Waiting as there are still 1 inflight and pending exchanges to complete,
timeout in 4948 seconds. Inflights per route: [UserCSVToDB = 1]
[el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy        INFO 
Waiting as there are still 1 inflight and pending exchanges to complete,
timeout in 4947 seconds. Inflights per route: [UserCSVToDB = 1]
[el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy        INFO 
Waiting as there are still 1 inflight and pending exchanges to complete,
timeout in 4946 seconds. Inflights per route: [UserCSVToDB = 1]
[el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy        INFO 
Waiting as there are still 1 inflight and pending exchanges to complete,
timeout in 4945 seconds. Inflights per route: [UserCSVToDB = 1]
[el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy        INFO 
Waiting as there are still 1 inflight and pending exchanges to complete,
timeout in 4944 seconds. Inflights per route: [UserCSVToDB = 1]
[el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy        INFO 
Waiting as there are still 1 inflight and pending exchanges to complete,
timeout in 4943 seconds. Inflights per route: [UserCSVToDB = 1]
[el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy        INFO 
Waiting as there are still 1 inflight and pending exchanges to complete,
timeout in 4942 seconds. Inflights per route: [UserCSVToDB = 1]





--
View this message in context: 
http://camel.465427.n5.nabble.com/Route-shudtdown-using-Route-Policy-not-working-tp5777220.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to