davsclaus commented on code in PR #26850:
URL: https://github.com/apache/camel/pull/26850#discussion_r4093364844
##########
core/camel-core-processor/src/main/java/org/apache/camel/processor/PollEnricher.java:
##########
@@ -467,6 +466,8 @@ public boolean process(Exchange exchange, AsyncCallback
callback) {
} catch (Exception e) {
exchange.setException(new CamelExchangeException("Error occurred
during aggregation", exchange, e));
+ // handover any synchronization, so the polled resource is
released (such as a file being rolled back)
+ handoverCompletions(resourceExchange, exchange);
Review Comment:
You are right, thank you. Handing the completions over on the failure paths
tied the file's commit to how the original exchange ends, so a recovered
exchange committed a file whose content was never used.
Fixed in 0a29045dcb00, following your suggestion:
- **pollEnrich:** when the resource failed, when the aggregation threw, or
on the `variableReceive` early return, the resource's synchronizations now run
right away as failed (`UnitOfWorkHelper.doneSynchronizations`). A polled file
is rolled back and can be polled again. They are only handed over when the
resource was used, meaning aggregated or discarded by the strategy returning
null.
- **enrich:** the same split, so a failed resource is released as failed
right away. This still only applies when the unit of work is not shared.
- **Tests:** your reproducer is now
`testFileNotAggregatedIsNotCommittedWhenRedeliverySucceeds`. It fails 3 out of
3 runs with the previous version of this PR and passes 3 out of 3 with the fix.
`EnricherResourceCompletionTest` now also checks that the failure cases
complete the resource as failed. The full camel-core suite passes (7573 tests).
_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]