davsclaus commented on code in PR #26523:
URL: https://github.com/apache/camel/pull/26523#discussion_r4029567213
##########
components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaProducerTest.java:
##########
@@ -189,6 +192,39 @@ public void processAsyncSendsMessageWithException() {
assertRecordMetadataExists();
}
+ @Test
+ public void processAsyncCompletesCallbackWhenBeginTransactionFails()
throws Exception {
+ // CAMEL-24780: a failure to begin the transaction must set the
exception and complete the async
+ // callback rather than escaping process(), and it must not leave the
unit of work flagged as
+ // transacted without a synchronization to commit or roll it back.
+ setTransactionId(producer, "test-tx");
Review Comment:
Optional: the reflection is needed only because the fixture never calls
`doStart()`, where `transactionId` is derived.
`endpoint.getConfiguration().setTransactionalId("test-tx");
producer.doStart();` would exercise the real init path (`initTransactions()` is
a no-op on the mock and the worker pool is already set), and the
`setTransactionId` helper could go. Fine as is if you prefer to keep the test
independent of `doStart()`.
--
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]