Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-9882

Support importing Camel XML configuration files in Camel CDI

    XMLWordPrintableJSON

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.18.0
    • Component/s: camel-cdi
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      So that user can use their existing Camel XML files with CDI or use Camel XML for configuring their Camel contexts.

      For example, given the following Camel XML:

      <camelContext id="test" errorHandlerRef="error-handler"
                    xmlns="http://camel.apache.org/schema/spring">
      
          <errorHandler id="error-handler"
                        type="LoggingErrorHandler"
                        logName="error"
                        level="WARN"/>
      
          <route>
              <from uri="direct:inbound"/>
              <choice>
                  <when>
                      <simple>${body} contains 'exception'</simple>
                      <throwException ref="failure"/>
                  </when>
                  <otherwise>
                      <transform>
                          <simple>Response to ${body}</simple>
                      </transform>
                      <to uri="mock:outbound"/>
                  </otherwise>
              </choice>
          </route>
      
      </camelContext>
      

      And following bean:

      @Named
      @Produces
      Exception failure = new CamelException("failure message!");
      

      The Camel XML elements with an id attributes (errorHandler in the example) get deployed as CDI beans and vice-versa the ref attributes can refer to CDI beans (@Named("failure") in the example).

      The current proposition is to expose an annotation that the developer can use on any CDI bean to declare the Camel XML files to import in her/his Camel CDI application, e.g.:

      @ImportResource("imported-context.xml")
      class MyCamelCdiBean {
      }
      

        Attachments

          Activity

            People

            • Assignee:
              antonin.stefanutti Antonin Stefanutti
              Reporter:
              antonin.stefanutti Antonin Stefanutti
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: