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

   # Description
   
   [CAMEL-25154](https://issues.apache.org/jira/browse/CAMEL-25154)
   
   Since CAMEL-22044 (4.12.0), `VertxHttpProducer` handles `File` and 
`WrappedFile` bodies in their own branch. The branch converts the body to 
`java.io.File` and sends nothing when the conversion returns null. The remote 
file consumers without a `localWorkDirectory` (camel-ftp for FTP, FTPS and 
SFTP, and camel-smb) put a `RemoteFile` on the message. Its content is already 
downloaded as `byte[]`, or is an `InputStream` with `streamDownload`, and there 
is no conversion from either to `File`. So nothing is sent, the callback is 
never called, and `process` returns false, so the exchange never completes.
   
   For `from("sftp:...").to("vertx-http:...")`, the polling thread waits 
forever on the first file, the route stops polling, and a graceful shutdown 
runs into its timeout. Before 4.12.0 such a body went through the conversion to 
a Vert.x `Buffer` and was sent. The comment on the branch ("could potentially 
also be a FTP file etc") shows that remote files were meant to be supported.
   
   This change: when the file body is not a local file, send its content as a 
`Buffer`. With `multipartUpload=true` it is sent as a multipart file upload 
named by the `CamelFileNameOnly` header, or by `multipartUploadName` when the 
header is missing. A local `File` is sent as before. If the conversion to 
`Buffer` fails, the exchange now fails through the existing catch block and no 
longer hangs.
   
   Tests:
   - New `VertxHttpRemoteFileBodyTest`. The body is a `GenericFile` whose file 
handle is not a `java.io.File` and whose content is `byte[]`, as the ftp and 
sftp consumers produce it. The test sends it once as a plain body (the server 
echoes the content) and once as a multipart upload (the server returns the file 
name and content). The exchange is sent with `asyncSend` and awaited for 10 
seconds.
   - Without the change, both tests fail with a `TimeoutException`: the 
exchange never completes. The existing file upload tests pass with and without 
the change.
   - With the change, all camel-vertx-http tests pass: 95 tests, 0 failures, 1 
skipped (the skip is not related to this change).
   
   Found while reviewing the producer's body handling. I then reproduced it 
with a local Vert.x server: no request reached the server and the exchange 
stayed inflight.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [ ] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
     (I built and tested the affected module, including the formatter and 
import-sort plugins. I did not run the full root build.)
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
     This PR was prepared with Claude Code (Claude Opus 5.5). The commit 
carries a `Co-Authored-By` trailer.
   
   _Claude Code on behalf of allthingssecurity_
   
   🤖 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