lburgazzoli commented on a change in pull request #842:
URL: https://github.com/apache/camel-kamelets/pull/842#discussion_r831314806



##########
File path: kamelets/kafka-source.kamelet.yaml
##########
@@ -134,4 +143,12 @@ spec:
         autoOffsetReset: "{{autoOffsetReset}}"
         groupId: "{{?consumerGroup}}"
       steps:
-      - to: "kamelet:sink"
+        - set-property:
+            name: deserializeHeaders
+            constant: "{{deserializeHeaders}}"
+        - choice:
+            when:
+              - simple: "${exchangeProperty.deserializeHeaders} == 'true'"
+                steps:
+                  - bean: 
"org.apache.camel.kamelets.utils.serialization.kafka.KafkaHeaderDeserializer"

Review comment:
       I was thinking about something slightly different like:
   
   ```java
   class SimpleTypeConverter {
       boolean enabled;
       
        void process(Exchange exchange) throws Exception {
            if (!enabled) {
                return
            }
        }
   }
   ```
   
   ```yaml
   apiVersion: camel.apache.org/v1alpha1
   kind: Kamelet
   metadata:
     name: kafka-source
   spec:
     definition:
         deserializeHeaders:
           type: boolean
           default: false
     template:
       beans: 
         - type: 
org.apache.camel.kamelets.utils.serialization.kafka.KafkaHeaderDeserializer
           name: deserialize-headers
           properties:
             enabled: "{{deserializeHeaders}}"
       from:
         uri: "kafka:{{topic}}"
         steps:
           - process: 
               ref: "{{deserialize-headers}}"
           - to: "kamelet:sink"
   ```
   
   So in essence, instead of setting/removing headers/properties we can 
configure the header deserializer directly instead of 
setting/evaluating/removing an header for each message:
   




-- 
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