christophd commented on PR #4100:
URL: https://github.com/apache/camel-k/pull/4100#issuecomment-1462125460

   Added the implementation of the data types support in KameletBindings.
   
   The idea is to allow the user to specify the data types for output/input on 
Kamelet references in a binding (see source and sink Kamelets in example below).
   
   ```yaml
   apiVersion: camel.apache.org/v1alpha1
   kind: KameletBinding
   metadata:
     name: event-binding
   spec:
     source:
       ref:
         kind: Kamelet
         apiVersion: camel.apache.org/v1alpha1
         name: event-source
       dataTypes:
         out:
           format: cloudevents
     sink:
       ref:
         kind: Kamelet
         apiVersion: camel.apache.org/v1alpha1
         name: event-sink
       dataTypes:
         in:
           format: binary
   ```
   
   Once the user explicitly defines the data types in the binding Camel K 
automatically adds respective steps (using the data-type-action Kamelet) in 
order to apply the data types for input/output (see generated 
`template-flow.yaml` below).
   
   ```yaml
   from:
     uri: kamelet:event-source/source
     steps:
       - kamelet:
           name: data-type-action/source-out
       - kamelet:
           name: data-type-action/sink-in
       - to: kamelet:event-sink/sink
   ```
   
   This is for data types being set on source and sink Kamelet references in a 
binding. Also, the user is able to add data types to Kamelet reference used in 
the steps section of a binding:
   
   ```yaml
   apiVersion: camel.apache.org/v1alpha1
   kind: KameletBinding
   metadata:
     name: event-binding
   spec:
     source:
       ref:
         kind: Kamelet
         apiVersion: camel.apache.org/v1alpha1
         name: event-source
     steps:
       - ref:
           kind: Kamelet
           apiVersion: camel.apache.org/v1alpha1
           name: log-action
         dataTypes:
           out:
             format: binary
     sink:
       ref:
         kind: Kamelet
         apiVersion: camel.apache.org/v1alpha1
         name: event-sink
   ```
   
   This time the generated `template-flow.yaml` looks like this:
   
   ```yaml
   from:
     uri: kamelet:event-source/source
     steps:
       - pipeline:
           id: action-0-pipeline
           steps:
             - kamelet:
                 name: log-action/action-0
             - kamelet:
                 name: data-type-action/action-0-out
       - to: kamelet:event-sink/sink
   ```
   
   Camel K uses a pipeline step in order to apply the data type action as an 
output of the log-action step.
   
   The automatically added data type-action Kamelet steps will apply the given 
data format using the format name and an optional component scheme. At the 
moment the data type conversion logic is loaded from the camel-kamelet-utils 
library that holds some default data type implementations for AWS-S3, AWS-DDB 
and common String and binary data types (see 
https://github.com/apache/camel-kamelets/tree/main/library/camel-kamelets-utils/src/main/java/org/apache/camel/kamelets/utils/format/converter).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to