Opinionated auto-configuration of the Camel context. Auto-detects Camel routes available in the Spring context and exposes the key Camel utilities (like producer template, consumer template and type converter).
The most important piece of functionality provided by the Camel starter is {@code CamelContext} instance. Fabric Camel starterwill create {@code SpringCamelContext} for your and take care of the proper initialization and shutdown of that context. CreatedCamel context is also registered in the Spring application context (under {@code camelContext} name), so you can access it justas the any other Spring bean.
{@literal @}Configuration public class MyAppConfig { {@literal @}Autowired CamelContext camelContext; {@literal @}Bean MyService myService() { return new DefaultMyService(camelContext); } }
Camel starter collects all the `RoutesBuilder` instances from the Spring context and automatically injects them into the provided {@code CamelContext}. It means that creating new Camel route with the Spring Boot starter is as simple as adding the {@code @Component} annotated class into your classpath:
{@literal @}Component public class MyRouter extends RouteBuilder { {@literal @}Override public void configure() throws Exception { from("jms:invoices").to("file:/invoices"); } }
Or creating new route {@code RoutesBuilder} in your {@code @Configuration} class:
{@literal @}Configuration public class MyRouterConfiguration { {@literal @}Bean RoutesBuilder myRouter() { return new RouteBuilder() { {@literal @}Override public void configure() throws Exception { from("jms:invoices").to("file:/invoices"); } }; } }