Versions Compared

Key

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

...

Grape component allows you to fetch, load and manage additional jars when CamelContext is running. In practice with Camel Grape component you can add new components, data formats and beans to your CamelContext without the restart of the router. Grape component supports only producer endpoints.

Setting up class loader

Grape requires using Groovy class loader with CamelContext. You can enable Groovy class loading on the existing Camel Context using the GrapeComponent#grapeCamelContext() method:

 

Code Block
languagejava
CamelContext camelContext = grapeCamelContext(new DefaultCamelContext());

 You can also set up the Groovy class loader by yourself:

Code Block
languagejava
camelContext.setApplicationContextClassLoader(new GroovyClassLoader(myClassLoader));

URI format

Code Block
grape:defaultMavenCoordinates[?options]

For example the following snippet loads Camel FTP component:

Code Block
languagejava
from("direct:loadCamelFTP").
  to("grape:org.apache.camel/camel-ftp/2.15.2");

...