davsclaus opened a new pull request, #30472:
URL: https://github.com/apache/camel/pull/30472

   [CAMEL-27267](https://issues.apache.org/jira/browse/CAMEL-27267)
   
   > **Stacked on #30471 (CAMEL-27266).** The base is its branch, so only this 
change shows. I'll retarget to `main` once #30471 merges, which is when CI 
builds it.
   
   ### The problem
   Since CAMEL-27258, the `application-octet-stream` (`binary`) data type keeps 
a stream cache body. It still reads a `java.io.File` or a `WrappedFile` body 
into a `byte[]`, such as the `GenericFile` of the file and FTP consumers. A 
file is binary already, can be read again, and may be large. Because of this, 
the object and file sinks of the Kamelet catalog (S3, Azure Storage, Google 
Storage, MinIO, FTP, …) can't declare a `binary` in default: it would read 
every file into memory before the upload.
   
   ### The change
   - **`ByteArrayDataTypeTransformer`:** keeps a `File` or `WrappedFile` body 
as it is and only sets `Content-Type: application/octet-stream`, as it does for 
a stream cache. Any other body still becomes a `byte[]`.
   - **`@BodyTypes`:** `transformerOut` lists `file`. The generated metadata 
and its catalog copy are updated.
   - **Upgrade guide 4.24:** the note on the binary data type now also covers 
files.
   
   This is part of the data types work for the Kamelet catalog 
(apache/camel-kamelets#3117, CAMEL-25928).
   
   ### Tests
   - `ByteArrayDataTypeTransformerTest`:
     - a `File` and a `GenericFile` body are kept as the same instance and get 
the header;
     - their content is still readable;
     - the body types list `file`.
   - Run locally:
     - camel-core: the data type transformer tests, `EipBodyTypesTest`, 
`TransformerContractTest`, `DataTypeProcessorTest`, 
`BinaryDataTypeOneShotStreamTest`: 41 pass;
     - camel-yaml-dsl-validator: all 374 pass, against a catalog jar packaged 
with this change.
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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