allthingssecurity commented on PR #30001:
URL: https://github.com/apache/camel/pull/30001#issuecomment-6891315970

   Thanks @davsclaus. Pushed f06ff116b770 on top of your rebase, point by point:
   
   1. **Transacted exchange**: `SyncSend.process(Exchange)` now calls 
`producer.process(exchange)` directly, as you sketched, so a transacted 
exchange goes through the sync method of the producer again (the producer here 
is the one `withSendHook` returns, so with a send hook it is the same object as 
on main). `processTransacted` already sets a thrown exception on the exchange. 
Test: 
`DefaultProducerCacheProducerThrowsTest.testTransactedSyncSendCallsTheSyncMethodOfTheProducer`,
 a transacted exchange and a producer whose `process(Exchange)` records the 
call and sets its own body; on the previous head the async method of the 
producer ran instead.
   2. **`SEND_TWICE` handed off**: in `HookedSend.send()`, when the 
compare-and-set fails while the producer of the first of two sends runs, the 
first send was handed off (`HANDED_OFF`), so the throw is logged at WARN and 
`send()` returns `false`; the thread that completed the first send makes the 
second send and completes the send. A throw after the callback of a single send 
(or of the second send) is still thrown on as before. Test: 
`SendHelperTest.testSendTwiceFirstSendHandedOffThenThrowGoesOnAsynchronously`: 
the producer completes the first send with `done(false)` and throws, the second 
send is still running; `process` returns `false` without an exception, the 
callback is not called yet, and once the second send completes the callback is 
called once, with no exception on the exchange and `afterSend` once. On the 
previous head the exception was thrown to the caller instead.
   3. **Upgrade guide**: added that a plain `to` that needs no callback of its 
own keeps the old behaviour for such a producer, and that camel-tracing / 
camel-telemetry now see one sending/sent pair per async send of the 
`ProducerTemplate` instead of two.
   4. **Inflight**: `testSyncSendThrowBeforeCallbackFails` now asserts 
`context.getInflightRepository().size() == 0` (the new transacted test does 
too).
   5. **Comment in `SyncSend.done`**: added; there the callback runs the after 
advices of the shared processor (the end of the unit of work) and completes the 
sync send, so a second call is not passed on, unlike `SentCallback`, whose 
caller is a route step that ignores it.
   
   Out of scope: `EventNotifierProducer.process` has the same catch, agreed; 
that would be a follow-up JIRA, not part of this PR.
   
   Tests (run with the same commit on the branch before your rebase; the 
follow-up is the same patch): the camel-core processor tests, producer cache, 
template, event notifier, send hook, send helper, `SendTwiceTest`, 
`CompositeHookTest`, transacted and sanitizer tests: 3695 run, 0 failures, 1 
error, 18 skipped. The error is 
`EventNotifierExchangeSentTest.testExchangeWireTap`, which waits only 1 second 
for the wire tap's async events; it failed the same way on an unrelated branch 
on my machine before, under the same parallel load. The new tests pass 
(`DefaultProducerCacheProducerThrowsTest` 12, `SendHelperTest` 45, 
`SendProcessorProducerThrowsTest` 3).
   
   _Claude Code on behalf of allthingssecurity_
   


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