0

I have following route class

public class FileReaderRoute extends RouteBuilder {

    @Override
    public void configure() throws Exception {
        from("file:{{file.encrypt.source}}?noop=true;delete=true")
                .setProperty("fileName", simple("${in.header.CamelFileName}")).log("File Reader Route route started")
                .to("direct:addSignatureRoute");
    }

}

I have loaded above route using springboot. So if i run the application, route get started and start reading files in given location.

My requirement is to start and stop the route on runtime ie After running the application. route must be started only if i send request to that application on demand and stop the route by sending request to the running app.

rocky
  • 753
  • 2
  • 10
  • 26

1 Answers1

0

You can give an id to your route:

from("file:...")
.id("myroute")
...
.autoStartUp(false);

And the use this id to stop/start the corresponding route:

camelContext.startRoute("myroute");
TacheDeChoco
  • 3,683
  • 1
  • 14
  • 17