Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
import static org.apache.camel.component.grape.GrapeEndpoint.loadPatches;

... 
camelContext.addRoutes(
  new RouteBuilder() { 
    @Override 
    public void configure() throws Exception { 
      loadPatches(camelContext);
 
      from("direct:loadCamelFTP").
        to("grape:org.apache.camel/camel-ftp/2.15.2"); 
    }
  });

 

Managing the installed jars

If you would like to check what jars have been installed into the given CamelContext, send message to the grape endpoint with the CamelGrapeCommand header set to GrapeCommand.listPatches:

Code Block
languagejava
      from("netty-http4:http://0.0.0.0:80/patches").
        setHeader(GrapeConstats.GRAPE_COMMAND, constant(CamelGrapeCommand.listPatches)).
        to("grape:list"); 

Connecting the to the route defined above using the HTTP client returns the list of the jars installed by Grape component:

Code Block
$ curl http://my-router.com/patches
grape:org.apache.camel/camel-ftp/2.15.2
grape:org.apache.camel/camel-jms/2.15.2

If you would like to remove the installed jars, so these won't be loaded again after the context restart, use the GrapeCommand.clearPatches command:

Code Block
languagejava
      from("netty-http4:http://0.0.0.0:80/patches").
        setHeader(GrapeConstats.GRAPE_COMMAND, constant(CamelGrapeCommand.clearPatches)).
        setBody().constant("Installed patches have been deleted."); 


Include Page
Endpoint See Also
Endpoint See Also