This is an automated email from the ASF dual-hosted git repository.

oscerd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git


The following commit(s) were added to refs/heads/main by this push:
     new c7b47c268 Fix #2941: make aws-ddb-sink honour its own operation 
property (#2992)
c7b47c268 is described below

commit c7b47c2680336f45421a70a2671e479edfc2a416
Author: Andrea Cosentino <[email protected]>
AuthorDate: Tue Sep 1 11:05:38 2026 +0200

    Fix #2941: make aws-ddb-sink honour its own operation property (#2992)
    
    The Kamelet declared an inbound data type default:
    
        dataTypes:
          in:
            default: json
    
    which makes Camel apply the aws2-ddb:application-json transformation at
    the kamelet:source boundary, before any template step runs. So by the time
    "setProperty operation" executed, the transformer had already resolved the
    operation from the body alone, defaulted to PutItem and stamped
    CamelAwsDdbOperation. That header then beat the endpoint's
    operation={{operation}} parameter in Ddb2Producer, leaving the Kamelet's
    operation property with no effect.
    
    The in-template transformDataType step was a no-op as a result: the
    transformer returns early once CamelAwsDdbItem or CamelAwsDdbKey is set.
    
    Dropping only the "default:" key stops the transformation happening at the
    boundary and lets the existing transformDataType step apply it after the
    operation is set. All of the declared input-type documentation -- schema,
    header docs, description -- is preserved.
    
    Probed each operation with `camel run`, replacing the terminal aws2-ddb
    endpoint with a log so the resolved headers are visible:
    
      PutItem     CamelAwsDdbItem + ALL_OLD
      DeleteItem  CamelAwsDdbKey + ALL_OLD
      UpdateItem  CamelAwsDdbKey + CamelAwsDdbUpdateValues + ALL_NEW
    
    Before the change UpdateItem produced the PutItem shape.
    
    The itest route carried a workaround that set the operation exchange
    property in the calling route; it is removed here, so the test now
    exercises the Kamelet's own property. AwsIT passes end to end against
    DynamoDB: 15 tests, 0 failures, all four ddb cases green.
    
    Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
---
 kamelets/aws-ddb-sink.kamelet.yaml                                 | 7 ++++++-
 .../src/test/resources/aws/ddb/aws-ddb-sink-route.yaml             | 3 ---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/kamelets/aws-ddb-sink.kamelet.yaml 
b/kamelets/aws-ddb-sink.kamelet.yaml
index e978ccee1..5e1e611c3 100644
--- a/kamelets/aws-ddb-sink.kamelet.yaml
+++ b/kamelets/aws-ddb-sink.kamelet.yaml
@@ -103,8 +103,13 @@ spec:
         type: boolean
         default: false
   dataTypes:
+    # No 'default:' here on purpose. Declaring a default input type makes Camel
+    # apply the aws2-ddb:application-json transformation at the kamelet:source
+    # boundary, before any step below runs -- so the operation set by this
+    # template was never visible to it and every message was transformed as
+    # PutItem. The transformDataType step below applies the same type after the
+    # operation is set. See #2941.
     in:
-      default: json
       types:
         json:
           format: "aws2-ddb:application-json"
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/aws/ddb/aws-ddb-sink-route.yaml 
b/tests/camel-kamelets-itest/src/test/resources/aws/ddb/aws-ddb-sink-route.yaml
index 1b8cbc6dd..06ef96047 100644
--- 
a/tests/camel-kamelets-itest/src/test/resources/aws/ddb/aws-ddb-sink-route.yaml
+++ 
b/tests/camel-kamelets-itest/src/test/resources/aws/ddb/aws-ddb-sink-route.yaml
@@ -24,9 +24,6 @@
       steps:
       - setBody:
           constant: "{{aws.ddb.json.data}}"
-      - setProperty:
-          name: operation
-          constant: "{{aws.ddb.operation}}"
       - log: "${body}"
       - to:
           uri: "kamelet:aws-ddb-sink"

Reply via email to