Christoph Deppisch created CAMEL-18698:
------------------------------------------

             Summary: Add support for multiple data types on components
                 Key: CAMEL-18698
                 URL: https://issues.apache.org/jira/browse/CAMEL-18698
             Project: Camel
          Issue Type: New Feature
          Components: camel-core
            Reporter: Christoph Deppisch


Each component consumes/produces input and output data when processing the 
exchange as part of the route. Usually a component reads data from the exchange 
message (body and header) as input and produces specific message content as an 
output.

The input and output of a component can be of various nature (e.g. Java POJO 
objects, Json objects, String, binary data, InputStream, etc.)

In order to simplify the interrelationship between components each component 
should allow well defined data types as input and output and provide basic 
transformation logic.

Having the possibility to choose, a user can specify the *format* option on an 
endpoint URI in order to specify the requested data type. Each component 
defines a set of supported data types and provides logic to convert to and from 
this data type.

{{from("kafka:topic?format=avro").to("aws2-s3:bucketName?format=string")}}

The example above lets the user choose one of the supported input/output data 
formats on the components kafka and aws2-s3. The components may offer specific 
logic to transform from/to the defined data type. Also there will be generic 
data type transformation logic that Camel already provides when converting 
types via TypeConverter.

The idea is to provide multiple supported data types for components and let the 
component automatically apply transformation logic to/from the data type that 
the user has chosen. 

On the one hand there is the transformation EIP and Camel provides powerful 
route DSL to perform transformations from one data type to another. But in many 
cases the component itself knows best how to transform from/to the domain model 
data type.

This is especially useful when dealing with components that use Java POJO 
objects as input/output. This way the user is able to deal with more common 
data types (e.g. String, Json) instead of having to know the domain model of 
the individual component. 

In particular this would be beneficial for Camel K and Kamelets (also see the 
discussions in https://github.com/apache/camel-k/issues/1980) where declarative 
YAML DSL is used to specify the route logic. In these declarative use cases the 
usage of custom Java processors to transform from one data type to another is 
not easily possible. Instead the components itself should provide predefined 
data type support and offer multiple types that the user may choose from.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to