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

   # Description
   
   [CAMEL-25915](https://issues.apache.org/jira/browse/CAMEL-25915), a 
follow-up to CAMEL-25896 (#28195) for two review comments that came in after it 
was merged.
   
   ### Change
   
   - **Reconnect with a custom `pollStrategy`** (from @allthingssecurity's 
review). With `sendNoop=false`, an ftp or ftps consumer finds a connection that 
the server has closed only when an operation fails. A failure while retrieving 
a file already made the consumer send a noop before the next poll. A failure 
thrown out of `poll()` relied on 
`RemoteFilePollingConsumerPollStrategy.rollback()` to disconnect instead, so 
with a custom poll strategy nothing disconnected, and every following poll 
failed on its first command (`PWD` with the default `stepwise=true`). 
`RemoteFileConsumer` now overrides `poll(Exchange)` and calls 
`sendNoopOnNextPollIfIOFailure(e)` before it rethrows. With the default poll 
strategy, `forceDisconnect()` clears the flag again, so nothing changes there.
   - **mina-sftp documentation** (from @oscerd's review). The mina-sftp noop is 
a request that waits for the reply, unlike the JSch keep-alive. So with 
`sendNoop=false`, a mina-sftp connection that dropped silently is found by the 
next poll, which fails before the consumer connects again. The upgrade guide 
and the `setSendNoop` Javadoc now say so, and point to `serverAliveInterval`. 
The `@UriParam` description is unchanged, so no generated files change.
   
   ### Tests
   
   New tests:
   - `RemoteFileConsumerSendNoopTest` (ftp/ftps/sftp, 6 new cases):
     - a poll that fails with an I/O error makes the next poll send a noop and 
connect again;
     - a poll that fails otherwise does not.
     The consumers in this test now get a mock process strategy, so that 
`poll()` can run.
   - `FtpConsumerSendNoopFalseIT`: the reproducer from the review, with a plain 
`DefaultPollingConsumerPollStrategy`. It consumes a file, closes all sessions 
on the server, and checks that the consumer logs in again and receives the 
second file.
   
   Negative check: without the `sendNoopOnNextPollIfIOFailure(e)` call in 
`poll(Exchange)`, the 3 new unit cases with an I/O error fail. The new IT fails 
with `Expected: <1> but was: <0>`, as in the review.
   
   Existing tests that also pass:
   - camel-ftp: `RemoteFileConsumerSendNoopTest` (45 cases in all), 
`RemoteFileProducerPreWriteCheckTest`, 
`RemoteFileConsumerStartingDirectoryJailTest`, `FtpConsumerSendNoopFalseIT`, 
`SftpConsumerSendNoopFalseIT`, `FtpProducerSendNoopFalseIT`, `FromFtpNoopIT`, 
`FromFtpConsumerTemplateIT`, `FromFtpUseListFalseIT`, 
`FtpConsumerTemplateUseListFalseIT`, `FtpConsumerDisconnectIT`, 
`FtpReconnectAttemptServerStoppedIT`, 
`FtpConsumerPostProcessingOnDisconnectIT`, 
`FtpConsumerDeleteNoWritePermissionIT`, `FromFtpSimulateNetworkIssueRecoverIT`, 
`FtpConsumerThrowExceptionOnLoginFailedIT`, and the Sftp 
simple/template/use-list ITs.
   - camel-mina-sftp: `MinaSftpConsumerSendNoopTest`, 
`MinaSftpOperationsDisconnectTest`, `MinaSftpErrorHandlingIT`, 
`MinaSftpServerAliveIT`, `MinaSftpSimpleConsumeIT`, `MinaSftpSimpleProduceIT`.
   - All camel-azure-files tests.
   
   Build: `formatter:format impsort:sort`, then `-Psourcecheck install 
-DskipTests` on camel-ftp-common, camel-ftp, camel-mina-sftp and 
camel-azure-files. That left no generated changes. I did not run `mvn clean 
install -DskipTests` from the root.
   
   # 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. (Built per module as described 
above, not from the root. The change touches no generated files.)
   
   # 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.
   
   _Claude Code on behalf of tyskjohan_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01SonJJYXyt16gNRQkSu72AH
   


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