essobedo commented on code in PR #9344:
URL: https://github.com/apache/camel/pull/9344#discussion_r1108061851


##########
core/camel-core/src/test/java/org/apache/camel/processor/SagaTimeoutTest.java:
##########
@@ -64,6 +70,29 @@ public void testTimeoutHasNoEffectIfCompleted() throws 
Exception {
         compensate.assertIsNotSatisfied();
     }
 
+    @Test
+    public void testTimeoutMultiParticipants() throws Exception {
+
+        MockEndpoint compensate = getMockEndpoint("mock:compensate");
+        compensate.expectedMessageCount(1);
+
+        MockEndpoint complete = getMockEndpoint("mock:complete");
+        complete.expectedMessageCount(2);

Review Comment:
   That should be `0` since the Saga participants are compensated none can be 
completed. The participants cannot be both completed and compensated.



##########
core/camel-core/src/test/java/org/apache/camel/processor/SagaTimeoutTest.java:
##########
@@ -81,6 +110,29 @@ public void configure() throws Exception {
                         
.compensation("mock:compensate").completion("mock:complete")
                         .to("mock:end");
 
+                from("direct:saga-multi-participants")
+                        .process(exchange -> {
+                            exchange.getMessage().setHeader("id", 
UUID.randomUUID().toString());
+                        })
+                        .saga()
+                        .propagation(SagaPropagation.REQUIRES_NEW)
+                        .to("direct:service1")
+                        .to("direct:service2");
+
+                from("direct:service1")
+                        .saga().option("id", header("id"))
+                        .propagation(SagaPropagation.MANDATORY).timeout(100, 
TimeUnit.MILLISECONDS)
+                        
.compensation("mock:compensate").completion("mock:complete")
+                        .process(exchange -> {
+                            Thread.sleep(300L, 0);
+                        })

Review Comment:
   You could use the `delay` EIP instead 
https://camel.apache.org/components/3.20.x/eips/delay-eip.html



##########
core/camel-core/src/test/java/org/apache/camel/processor/SagaTimeoutTest.java:
##########
@@ -64,6 +70,29 @@ public void testTimeoutHasNoEffectIfCompleted() throws 
Exception {
         compensate.assertIsNotSatisfied();
     }
 
+    @Test
+    public void testTimeoutMultiParticipants() throws Exception {
+
+        MockEndpoint compensate = getMockEndpoint("mock:compensate");
+        compensate.expectedMessageCount(1);

Review Comment:
   That should be `2`, when a timeout expires all participants should be 
compensated



-- 
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: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to