Class CamelConfiguration

  • All Implemented Interfaces:
    org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.context.ApplicationContextAware
    Direct Known Subclasses:
    SingleRouteCamelConfiguration

    @Configuration
    public abstract class CamelConfiguration
    extends Object
    implements org.springframework.beans.factory.BeanFactoryAware, org.springframework.context.ApplicationContextAware
    A useful base class for writing Spring annotation-based configurations for working with Camel.
    • Constructor Detail

      • CamelConfiguration

        public CamelConfiguration()
    • Method Detail

      • setBeanFactory

        public void setBeanFactory​(org.springframework.beans.factory.BeanFactory beanFactory)
        Specified by:
        setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
      • getBeanFactory

        protected org.springframework.beans.factory.BeanFactory getBeanFactory()
      • setApplicationContext

        public void setApplicationContext​(org.springframework.context.ApplicationContext ac)
        Specified by:
        setApplicationContext in interface org.springframework.context.ApplicationContextAware
      • getApplicationContext

        protected org.springframework.context.ApplicationContext getApplicationContext()
      • getBean

        public <T> T getBean​(Class<T> type)
      • getBean

        public <T> T getBean​(String beanName,
                             Class<T> type)
      • getConfigured

        protected <T> T getConfigured​(T object)
        Invoke callbacks on the object, as though it were configured in the factory. If appropriate, the object may be wrapped before being returned. For this reason, it is recommended to always respect the return value when using this method.
        Parameters:
        object - object to configure
        Returns:
        either the original object or a wrapped one after callbacks called on it.
      • producerTemplate

        @Bean(initMethod="",
              destroyMethod="")
        public org.apache.camel.ProducerTemplate producerTemplate​(org.apache.camel.CamelContext camelContext)
                                                           throws Exception
        Get's the ProducerTemplate to be used.
        Throws:
        Exception
      • consumerTemplate

        @Bean(initMethod="",
              destroyMethod="")
        public org.apache.camel.ConsumerTemplate consumerTemplate​(org.apache.camel.CamelContext camelContext)
                                                           throws Exception
        Get's the ConsumerTemplate to be used.
        Throws:
        Exception
      • camelBeanPostProcessor

        @Bean
        public org.apache.camel.spring.CamelBeanPostProcessor camelBeanPostProcessor()
                                                                              throws Exception
        Camel post processor - required to support Camel annotations.
        Throws:
        Exception
      • camelContext

        @Bean
        public org.apache.camel.CamelContext camelContext()
                                                   throws Exception
        Get's the CamelContext to be used.
        Throws:
        Exception
      • setupCamelContext

        protected void setupCamelContext​(org.apache.camel.CamelContext camelContext)
                                  throws Exception
        Callback to setup CamelContext before its started
        Throws:
        Exception
      • createCamelContext

        protected org.apache.camel.CamelContext createCamelContext()
                                                            throws Exception
        Factory method returning CamelContext used by this configuration.
        Returns:
        CamelContext used by this configuration. By default SpringCamelContext instance is created, to fully integrate Spring application context and Camel registry.
        Throws:
        Exception
      • routes

        public List<org.apache.camel.builder.RouteBuilder> routes()
        Returns the list of routes to use in this configuration. By default autowires all RouteBuilder instances available in the ApplicationContext.