zhfeng commented on code in PR #7454:
URL: https://github.com/apache/camel/pull/7454#discussion_r857076341


##########
components/camel-kafka/src/test/java/org/apache/camel/component/kafka/integration/KafkaProducerFullIT.java:
##########
@@ -155,10 +175,60 @@ public void configure() {
                 
from("direct:propagatedHeaders").to(toPropagatedHeaders).to(mockEndpoint);
 
                 
from("direct:noRecordSpecificHeaders").to(toNoRecordSpecificHeaders).to(mockEndpoint);
+
+                from("direct:startTransaction").transacted("kafkaTransaction")
+                        .to(toTransaction).process(new Processor() {
+                            @Override
+                            public void process(Exchange exchange) throws 
Exception {
+                                String body = 
exchange.getIn().getBody(String.class);
+                                if (body.contains("fail")) {
+                                    throw new RuntimeException("fail process 
message " + body);
+                                }
+                            }
+                        }).to(mockEndpoint);
             }
         };
     }
 
+    @Test
+    public void producedTransactionMassageIsReceivedByKafka() throws 
InterruptedException {
+        int messageInTopic = 10;
+        int messageInOtherTopic = 5;
+
+        CountDownLatch messagesLatch = new CountDownLatch(messageInTopic + 
messageInOtherTopic);
+
+        sendMessagesInRoute(messageInTopic, testTransaction, "IT test 
transaction message", KafkaConstants.PARTITION_KEY, "0");
+        try {
+            sendMessagesInRoute(messageInTopic, testTransaction, "IT test 
transaction fail message",
+                    KafkaConstants.PARTITION_KEY,
+                    "0");
+            fail("Should fail in transaction");
+        } catch (Exception e) {
+        }

Review Comment:
   Done



##########
components/camel-kafka/src/test/java/org/apache/camel/component/kafka/integration/KafkaProducerFullIT.java:
##########
@@ -58,6 +60,7 @@
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 public class KafkaProducerFullIT extends BaseEmbeddedKafkaTestSupport {

Review Comment:
   Done



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