davsclaus commented on issue #3117:
URL: 
https://github.com/apache/camel-kamelets/issues/3117#issuecomment-7013300226

   **Source Kamelets: an `out` default does not run where this issue expects.** 
Found while doing #3275.
   
   `KameletRoutesBuilderLoader` makes the `out` default the output type of the 
template route, and `ContractAdvice.after()` applies it once that route has 
finished. A source hands each message on through `kamelet:sink`, which runs the 
consuming route inside it. So for a source:
   - **The next step never sees the declared type.** With a test source 
declaring `out: binary` and giving `"hello"`, the first step of the consuming 
route saw `java.lang.String` and no `Content-Type`.
   - **The message can fail at the end.** When the consuming route ends with a 
body the transformer cannot convert, the exchange fails after the route: with a 
`Map`, `CamelExecutionException: Failed to convert body to 'java:[B' ... at 
ContractAdvice.after(ContractAdvice.java:104)`. A broker or queue source then 
gets the message again.
   
   Checked with `camel run` on 4.24.0-SNAPSHOT.
   
   This affects the 16 sources that already declare an `out` default, such as 
`aws-s3-source`, `aws-sqs-source`, `azure-storage-blob-source` and 
`azure-eventhubs-source`. For example, `aws-s3-source` followed by 
`json-deserialize-action` and a step that leaves a `Map` would fail each 
message.
   
   Sink `in` and action defaults are not affected: they run where expected 
(#3263, #3275).
   
   **Plan:**
   - **No new source defaults** until Camel applies a source's output type when 
the message is handed to `kamelet:sink`. That needs a CAMEL issue.
   - **The existing source defaults:** decide whether to keep them until that 
fix, or remove them now.
   
   _Claude Code on behalf of Claus Ibsen_
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to