This is an automated email from the ASF dual-hosted git repository.

apupier pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 2c0ae688b1f0 CAMEL-28025: camel-robotframework - serialize Robot 
Framework runs, they redirect the JVM wide stdout and stderr
2c0ae688b1f0 is described below

commit 2c0ae688b1f0da21519c331a9375bbeddf10f897
Author: AurĂ©lien Pupier <[email protected]>
AuthorDate: Wed Dec 2 10:05:02 2026 +0100

    CAMEL-28025: camel-robotframework - serialize Robot Framework runs, they 
redirect the JVM wide stdout and stderr
    
    Co-authored-by: IBM Bob <[email protected]>
---
 .../camel/catalog/docs/robotframework-component.adoc      |  4 ++++
 .../src/main/docs/robotframework-component.adoc           |  4 ++++
 .../component/robotframework/RobotFrameworkEndpoint.java  | 15 ++++++++++++++-
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/robotframework-component.adoc
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/robotframework-component.adoc
index 136f2b7852f8..12fa4921df39 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/robotframework-component.adoc
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/robotframework-component.adoc
@@ -45,6 +45,10 @@ Where *resourceUri* is the file system path of the test 
suite file (such as `fol
 directory to run. It is passed to Robot Framework as is, so a relative path is 
resolved against the current working
 directory. A scheme such as `classpath:` or `file:` is not supported.
 
+NOTE: Robot Framework runs in the JVM of the application and redirects the JVM 
wide standard output and
+standard error during a run. The component therefore runs one Robot Framework 
execution at a time in a JVM:
+concurrent exchanges, consumers and routes wait for the run in progress to 
complete.
+
 // component options: START
 include::partial$component-configure-options.adoc[]
 include::partial$component-endpoint-options.adoc[]
diff --git 
a/components/camel-robotframework/src/main/docs/robotframework-component.adoc 
b/components/camel-robotframework/src/main/docs/robotframework-component.adoc
index 136f2b7852f8..12fa4921df39 100644
--- 
a/components/camel-robotframework/src/main/docs/robotframework-component.adoc
+++ 
b/components/camel-robotframework/src/main/docs/robotframework-component.adoc
@@ -45,6 +45,10 @@ Where *resourceUri* is the file system path of the test 
suite file (such as `fol
 directory to run. It is passed to Robot Framework as is, so a relative path is 
resolved against the current working
 directory. A scheme such as `classpath:` or `file:` is not supported.
 
+NOTE: Robot Framework runs in the JVM of the application and redirects the JVM 
wide standard output and
+standard error during a run. The component therefore runs one Robot Framework 
execution at a time in a JVM:
+concurrent exchanges, consumers and routes wait for the run in progress to 
complete.
+
 // component options: START
 include::partial$component-configure-options.adoc[]
 include::partial$component-endpoint-options.adoc[]
diff --git 
a/components/camel-robotframework/src/main/java/org/apache/camel/component/robotframework/RobotFrameworkEndpoint.java
 
b/components/camel-robotframework/src/main/java/org/apache/camel/component/robotframework/RobotFrameworkEndpoint.java
index d9810e4f03e1..b30c8ba64d9e 100644
--- 
a/components/camel-robotframework/src/main/java/org/apache/camel/component/robotframework/RobotFrameworkEndpoint.java
+++ 
b/components/camel-robotframework/src/main/java/org/apache/camel/component/robotframework/RobotFrameworkEndpoint.java
@@ -18,6 +18,7 @@ package org.apache.camel.component.robotframework;
 
 import java.util.Arrays;
 import java.util.List;
+import java.util.concurrent.locks.ReentrantLock;
 
 import org.apache.camel.Category;
 import org.apache.camel.Exchange;
@@ -55,6 +56,12 @@ import org.robotframework.RobotFramework;
                                                  + " test does not fail the 
exchange"))
 public class RobotFrameworkEndpoint extends ResourceEndpoint {
 
+    /**
+     * Robot Framework runs in-process on Jython and redirects the JVM wide 
System.out and System.err during a run, so
+     * runs must not overlap in the same JVM.
+     */
+    private static final ReentrantLock RUN_LOCK = new ReentrantLock();
+
     @UriParam
     private RobotFrameworkCamelConfiguration configuration;
 
@@ -208,7 +215,13 @@ public class RobotFrameworkEndpoint extends 
ResourceEndpoint {
         generatedArguments.add(path);
 
         // run robot framework
-        int camelRobotReturnCode = 
RobotFramework.run(generatedArguments.toArray());
+        int camelRobotReturnCode;
+        RUN_LOCK.lock();
+        try {
+            camelRobotReturnCode = 
RobotFramework.run(generatedArguments.toArray());
+        } finally {
+            RUN_LOCK.unlock();
+        }
 
         
exchange.getIn().setHeader(RobotFrameworkCamelConstants.CAMEL_ROBOT_RETURN_CODE,
 camelRobotReturnCode);
     }

Reply via email to