Versions Compared

Key

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

...

The Camel CDI component provides auto-configuration for Apache Camel using CDI as dependency injection framework based on the on convention-over-configuration principle. It auto-detects Camel routes available in the application and provides beans for common Camel primitives like EndpointProducerTemplate or TypeConverter. It implements standard Camel bean integration so that Camel annotations like @Consume@Produce and @PropertyInject can be used seamlessly in CDI beans. Besides, it bridges Camel events (e.g. RouteAddedEvent, CamelContextStartedEvent or ExchangeCompletedEvent) as CDI events and provides a CDI events endpoint that can be used to consume / produce CDI events from / to Camel routes.

...

 

Code Block
languagejava
@ApplicationScoped
class CustomCamelContext extends DefaultCamelContext {

    @PostConstruct
    void customize() {
        // Set the Camel context name
        setName("custom");
        // Disable JMX
        disableJMX();
    }

    @PreDestroy
    void cleanUp() {
        // ...
    }
}

 

Producer and disposer methods can also be used as well to customize the Camel context bean, e.g.:

...