You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Antonin Stefanutti (JIRA)" <ji...@apache.org> on 2016/04/21 09:33:25 UTC
[jira] [Updated] (CAMEL-9882) Support importing Camel XML
configuration files in Camel CDI
[ https://issues.apache.org/jira/browse/CAMEL-9882?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Antonin Stefanutti updated CAMEL-9882:
--------------------------------------
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:
{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}
> 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)