Versions Compared

Key

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

...

In order to load the new component at the router runtime, just grab the jar containing the component:

Code Block
languagejava
ProducerTemplate template = camelContext.createProducerTemplate();
template.sendBody("grape:grape", "org.apache.camel/camel-stream/2.15.2");
template.sendBody("stream:out", "msg");

...

Code Block
ProducerTemplate template = camelContext.createProducerTemplate();
template.sendBody("grape:grape", "com.example/my-business-processors/1.0");
int productId = 1;
int price = template.requestBody("bean:com.example.PricingBean?method=currentProductPrice", productId, int.class)

 

Loading deployed jars after Camel context restart

After you download new jar, you usually would like to have it loaded by Camel again after the restart of the CamelContext. Grape component keeps track of the jar files you have installed. In order to load again the installed jars on the context startup, use the GrapeEndpoint.loadPatches() method in your route: 

 

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"); 
    }
  });


Include Page
Endpoint See Also
Endpoint See Also