[
https://issues.apache.org/jira/browse/CAMEL-9882?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Antonin Stefanutti resolved CAMEL-9882.
---------------------------------------
Resolution: Fixed
> Support importing Camel XML configuration files in Camel CDI
> ------------------------------------------------------------
>
> Key: CAMEL-9882
> URL: https://issues.apache.org/jira/browse/CAMEL-9882
> Project: Camel
> Issue Type: New Feature
> Components: camel-cdi
> Reporter: Antonin Stefanutti
> Assignee: Antonin Stefanutti
> Fix For: 2.18.0
>
>
> 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:
> {code}
> <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>
> {code}
> And following bean:
> {code}
> @Named
> @Produces
> Exception failure = new CamelException("failure message!");
> {code}
> 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.:
> {code}
> @ImportResource("imported-context.xml")
> class MyCamelCdiBean {
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)