Tomohisa Igarashi created CAMEL-10447:
-----------------------------------------
Summary: Add contract based type awareness
Key: CAMEL-10447
URL: https://issues.apache.org/jira/browse/CAMEL-10447
Project: Camel
Issue Type: New Feature
Components: camel-core
Reporter: Tomohisa Igarashi
Assignee: Tomohisa Igarashi
Original proposal is available here:
https://github.com/kcbabo/sandbox/blob/master/camel-metadata.md
We'd like to propose adding contract based type awareness on the Camel Message
Exchange. It introduces following benefits to Camel users:
* Static evaluation and validation of data types and interactions in an
application.
* Runtime evaluation of data types and interactions
* The ability to start with a weak/dynamically typed application and move to a
statically typed application
* Support for declarative transformation / automatic type conversion
* Support for declarative validation of data types
Let's see the declarative transformation example:
{code:java}
from("direct:abc")
.inputType("java:org.example.Order")
.to("direct:d")
.inputType("xml:{org.example}xmlOrder")
.outputType("urn:acme:orderAck")
.to("direct:e")
{code}
Instead of specifying transform().marshal() programmatically in the route,
above declares data type contract of the endpoints. This example means that the
input message should be transformed from *java:org.example.Order* to
*xml:\{org.example\}xmlOrder* before it is sent to *direct:d* from *direct:abc*.
Once we add this feature, we can even validate if required transformer is
declared along the data type by some maven plugin or IDE at design time.
The most important thing is that this feature is *completely optional*, so it
doesn't make any effect on existing Camel applications at all unless type
declaration is explicitly added.
We've been discussing about this here in camel-dev:
http://camel.465427.n5.nabble.com/Adding-type-awareness-in-Camel-route-td5787621.html
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)