Class CamelModule

java.lang.Object
io.jooby.camel.CamelModule
All Implemented Interfaces:
io.jooby.Extension

public class CamelModule extends Object implements io.jooby.Extension
EIP using Camel: https://camel.apache.org.

 {
    install(new CamelModule(new MyRoutes()));

    get("/", ctx -> {

      Producer producer = require(Producer.class);
      ...
    });
 }

 class MyRoutes extends RouteBuilder {

   public void configure() throws Exception {
     from("direct://foo")
         .log(">>> ${body}");
   }
 }

 

Module integrates application.conf properties into Camel as well as ServiceRegistry services. See https://jooby.io/modules/camel/

Since:
3.0.0
Author:
edgar
  • Constructor Summary

    Constructors
    Constructor
    Description
    CamelModule(Class<? extends org.apache.camel.builder.RouteBuilder> route, Class<? extends org.apache.camel.builder.RouteBuilder>... routes)
    Creates a new camel module adding one or more routes.
    CamelModule(org.apache.camel.builder.RouteBuilder route, org.apache.camel.builder.RouteBuilder... routes)
    Creates a new camel module adding one or more routes.
    CamelModule(org.apache.camel.CamelContext camel)
    Creates module using the CamelContext.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    install(io.jooby.Jooby application)
     
    static org.apache.camel.CamelContext
    newCamelContext(io.jooby.Jooby application)
    Creates a new camel context from appplication.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.jooby.Extension

    lateinit
  • Constructor Details

    • CamelModule

      public CamelModule(org.apache.camel.CamelContext camel)
      Creates module using the CamelContext.
      Parameters:
      camel - Camel context.
    • CamelModule

      public CamelModule(org.apache.camel.builder.RouteBuilder route, org.apache.camel.builder.RouteBuilder... routes)
      Creates a new camel module adding one or more routes.
      Parameters:
      route - Route configuration.
      routes - Optional route configuration.
    • CamelModule

      public CamelModule(Class<? extends org.apache.camel.builder.RouteBuilder> route, Class<? extends org.apache.camel.builder.RouteBuilder>... routes)
      Creates a new camel module adding one or more routes. Route provisioning is delegated to Dependency Injection framework (if any), otherwise camel does basic/minimal injection using DefaultInjector.
      Parameters:
      route - Route configuration.
      routes - Optional route configuration.
  • Method Details

    • install

      public void install(@NonNull io.jooby.Jooby application) throws Exception
      Specified by:
      install in interface io.jooby.Extension
      Throws:
      Exception
    • newCamelContext

      public static org.apache.camel.CamelContext newCamelContext(io.jooby.Jooby application)
      Creates a new camel context from appplication.
      Parameters:
      application - Application.
      Returns:
      CamelContext.