Claus Ibsen created CAMEL-27290:
-----------------------------------

             Summary: camel-kamelet - with the Kamelet EIP, the output data 
type of an action Kamelet is applied after the rest of the route
                 Key: CAMEL-27290
                 URL: https://issues.apache.org/jira/browse/CAMEL-27290
             Project: Camel
          Issue Type: Bug
          Components: camel-kamelet
            Reporter: Claus Ibsen
             Fix For: 4.24.0


An action Kamelet's {{spec.dataTypes.out.default}} becomes the output type of 
the Kamelet route, which {{ContractAdvice.after()}} applies when that route 
completes. With {{to("kamelet:x-action")}} that is before the next step of the 
calling route. With the Kamelet EIP ({{kamelet("x-action")}}, YAML {{- kamelet: 
name: x-action}}), the {{kamelet:sink}} at the end of the action template 
continues with the rest of the calling route first, so the next steps see the 
body before the output type, and the transformer runs only afterwards. This is 
the same problem CAMEL-27258 fixed for source Kamelets.

Reproduced with {{camel run}} on 4.24.0-SNAPSHOT, with an action Kamelet whose 
{{dataTypes.out.default}} is {{application-octet-stream}}, on a String body:
{code:yaml}
- route:
    from:
      uri: timer:a?repeatCount=1
      steps:
        - setBody:
            constant: hello
        - kamelet:
            name: binout-action
        - log: "EIP after action: class=${body.getClass().getName()} 
ct=${header.Content-Type}"
- route:
    from:
      uri: timer:b?repeatCount=1&delay=1500
      steps:
        - setBody:
            constant: hello
        - to: kamelet:binout-action
        - log: "TO after action: class=${body.getClass().getName()} 
ct=${header.Content-Type}"
{code}
logs
{noformat}
EIP after action: class=java.lang.String ct=
Found transformer ByteArrayDataTypeTransformer for key 
java:java.lang.String/application-octet-stream
Found transformer ByteArrayDataTypeTransformer for key 
java:java.lang.String/application-octet-stream
TO after action: class=[B ct=application/octet-stream
{noformat}
Every action Kamelet with an output data type in the Kamelet catalog is 
affected when it is used through the Kamelet EIP.

Expected: the output type of an action Kamelet is applied before the Kamelet 
EIP continues (for example in {{KameletProducer}} for {{kamelet:sink}}, as 
CAMEL-27258 does for sources), and only once.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to