You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Raul Kripalani (JIRA)" <ji...@apache.org> on 2012/12/10 11:07:21 UTC

[jira] [Created] (CAMEL-5858) Camel Context Inheritance

Raul Kripalani created CAMEL-5858:
-------------------------------------

             Summary: Camel Context Inheritance
                 Key: CAMEL-5858
                 URL: https://issues.apache.org/jira/browse/CAMEL-5858
             Project: Camel
          Issue Type: New Feature
          Components: camel-core
            Reporter: Raul Kripalani
            Assignee: Raul Kripalani


Camel is a great foundation for building SOA-based integration platforms. 

To improve governance and code manageability, one tends to define a number of common policies/items to apply across all routes in the system, e.g. exception handlers, data format configurations, property placeholder configurations, component configurations, etc.

If you use Spring, defining common component configs is possible by placing them in a separate Spring App Context file and using Spring's <import /> directive, since components are just standard beans.

However, for Camel-specific elements, there's no good solution, so you end up repeating yourself a lot... Consider this for a DRY solution:

{code}
<camelContext id="parent.config" abstract="true">
  <onException>
    <exception>java.lang.Exception</exception>
    ... do something here...
  </onException>
  <dataFormats>
    <json ... />
    <jaxb ... />
  </dataFormats>
  <propertyPlaceholder id="properties" location="ref:myProperties"/>
</camelContext>
{code}

A new Camel Context could "absorb" the config above like this:

{code}
<camelContext parentId="parent.config">
  ... specific configuration ...
  ... routes ...
</camelContext>
{code}

This works nicely with OSGi because Camel Contexts are enlisted in the Service Registry, so they can access and introspect each other. For other environments, we'll have to design something else.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira