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

   # Description
   
   [CAMEL-25291](https://issues.apache.org/jira/browse/CAMEL-25291)
   
   Two places where camel-plc4x reports a failure as success:
   
   - **Producer.** With `autoReconnect=true`, a failed reconnect was logged 
("Unable to reconnect, skipping request") and the exchange completed 
successfully although nothing was written: error handlers and redeliveries 
never saw it. A failed write also replaced the message of the exchange with 
`null` (`exchange.setMessage(null)`), so a redelivery or a dead letter channel 
got an empty message.
   - **Polling consumer** (`pollEnrich`). A failed connection or read returned 
an exchange with an empty `Map` body and no exception, and a read without an 
answer within the timeout too (nearly always with `receiveNoWait()`).
   
   This change: the producer lets the reconnect failure fail the exchange and 
keeps the message; the polling consumer sets the exception of a failed 
connection or read on the returned exchange (`pollEnrich` copies it), returns 
`null` when nothing was received within the timeout (the `PollingConsumer` 
contract), and keeps the interrupt status. The "skipping request" of the 
producer came with the `autoReconnect` option (#8971) without a stated reason 
(the review only asked for WARN, in the event-driven consumer, which is not 
changed). The empty Map of the polling consumer was a choice of CAMEL-18861 
(#9254: "An exchange with an empty map is created when no connection could be 
made" (instead of no exchange)); the polling consumer still returns an exchange 
for a failed connection or read, now with the exception, and `null` only when 
nothing arrived within the timeout (as `camel-jpa`). The upgrade guide for 4.23 
gets a note, including how a periodically polling route can keep going while 
 the PLC is unreachable.
   
   Tests:
   - `Plc4XFailureTest` (new, mocked `Plc4XEndpoint`): failed reconnect and 
failed write in the producer, failed reconnect, failed read and no answer in 
the polling consumer, and a control read.
   - Without the change 5 fail; the control passes.
   - With the change the module suite passes (23 tests).
   
   # 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