RouteBuilderConfigurer
The RouteBuilderConfigurer
is a functional interface which is used for creating a routing rule using the DSL,
using Java lambda style.
rb -> rb.from("timer:foo").log("Hello Lambda");
Instances of RouteBuilderConfigurer are discovered and transformed into RouteBuilder instances which are added to the CamelContext.
Usage
To use RouteBuilderConfigurer
you need to create a method that returns RouteBuilderConfigurer
which then
allows to use Java lambda style to define a single route.
In the example below the method myRoute is used to create a Camel route that consume from Kafka and send the messages to JMS.
To make the route discoverable by Camel during startup, then the method must be annotated. In standalone mode with camel-main
you should use @BindToRegistry
and with Spring Boot use @Bean
and with Quarkus then use @Produce
.
public class MyConfiguration {
@BindToRegistry
public RouteBuilderConfigurer myRoute() {
return rb -> rb.from("kafka:cheese").to("jms:queue:foo");
}
}