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

Add contract based type awareness

    Details

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

      Description

      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:

      from("direct:abc")
              .inputType("java:org.example.Order")
          .to("direct:d")
              .inputType("xml:{org.example}xmlOrder")
              .outputType("urn:acme:orderAck")
          .to("direct:e")
      

      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

        Attachments

          Activity

            People

            • Assignee:
              igarashitm Tomohisa Igarashi
              Reporter:
              igarashitm Tomohisa Igarashi
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: