You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "martinweiler (via GitHub)" <gi...@apache.org> on 2026/10/19 22:30:27 UTC

[PR] [kie-issues#7206] Remove fallback to sequential mode in ForEachNodeInstance with async nodes [incubator-kie]

martinweiler opened a new pull request, #7208:
URL: https://github.com/apache/incubator-kie/pull/7208

   Closes: https://github.com/apache/incubator-kie/issues/7206


-- 
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-unsubscribe@kie.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie#7206] Remove fallback to sequential mode in ForEachNodeInstance with async nodes [incubator-kie]

Posted by "pefernan (via GitHub)" <gi...@apache.org>.
pefernan merged PR #7208:
URL: https://github.com/apache/incubator-kie/pull/7208


-- 
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-unsubscribe@kie.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [kie-issues#7206] Remove fallback to sequential mode in ForEachNodeInstance with async nodes [incubator-kie]

Posted by "martinweiler (via GitHub)" <gi...@apache.org>.
martinweiler commented on code in PR #7208:
URL: https://github.com/apache/incubator-kie/pull/7208#discussion_r4380703611


##########
kogito-jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ForEachParallelSubProcessAsyncTest.java:
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jbpm.bpmn2;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.jbpm.bpmn2.foreach.MiChildProcessProcess;
+import org.jbpm.bpmn2.foreach.MiParentProcessModel;
+import org.jbpm.bpmn2.foreach.MiParentProcessProcess;
+import org.jbpm.test.utils.ProcessTestHelper;
+import org.junit.jupiter.api.Test;
+import org.kie.api.event.process.ProcessStartedEvent;
+import org.kie.kogito.Application;
+import org.kie.kogito.internal.process.event.DefaultKogitoProcessEventListener;
+import org.kie.kogito.internal.process.runtime.KogitoProcessInstance;
+import org.kie.kogito.process.ProcessInstance;
+import org.kie.kogito.process.workitems.impl.DefaultKogitoWorkItemHandler;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Regression test for the false-positive in
+ * {@code LambdaSubProcessNodeInstance#hasAsyncNodeInstance}: a parallel

Review Comment:
   Thanks @Abhitocode - good catch about the stale reference!



-- 
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-unsubscribe@kie.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [kie-issues#7206] Remove fallback to sequential mode in ForEachNodeInstance with async nodes [incubator-kie]

Posted by "Abhitocode (via GitHub)" <gi...@apache.org>.
Abhitocode commented on code in PR #7208:
URL: https://github.com/apache/incubator-kie/pull/7208#discussion_r4380336445


##########
kogito-jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ForEachParallelSubProcessAsyncTest.java:
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jbpm.bpmn2;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.jbpm.bpmn2.foreach.MiChildProcessProcess;
+import org.jbpm.bpmn2.foreach.MiParentProcessModel;
+import org.jbpm.bpmn2.foreach.MiParentProcessProcess;
+import org.jbpm.test.utils.ProcessTestHelper;
+import org.junit.jupiter.api.Test;
+import org.kie.api.event.process.ProcessStartedEvent;
+import org.kie.kogito.Application;
+import org.kie.kogito.internal.process.event.DefaultKogitoProcessEventListener;
+import org.kie.kogito.internal.process.runtime.KogitoProcessInstance;
+import org.kie.kogito.process.ProcessInstance;
+import org.kie.kogito.process.workitems.impl.DefaultKogitoWorkItemHandler;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Regression test for the false-positive in
+ * {@code LambdaSubProcessNodeInstance#hasAsyncNodeInstance}: a parallel

Review Comment:
   Since` hasAsyncNodeInstance()` is deleted, can this comment be removed?
   



-- 
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-unsubscribe@kie.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [incubator-kie#7206] Remove fallback to sequential mode in ForEachNodeInstance with async nodes [incubator-kie]

Posted by "josedee (via GitHub)" <gi...@apache.org>.
josedee commented on code in PR #7208:
URL: https://github.com/apache/incubator-kie/pull/7208#discussion_r4415722802


##########
kogito-jbpm/jbpm-tests/src/test/bpmn/org/jbpm/bpmn2/foreach/MiParentProcess.bpmn2:
##########
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<definitions id="MiParentProcessDef"
+             targetNamespace="http://www.example.org/MinimalExample"
+             typeLanguage="http://www.java.com/javaTypes"
+             expressionLanguage="http://www.mvel.org/2.0"
+             xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
+             xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
+             xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
+             xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
+             xmlns:tns="http://www.jboss.org/drools">
+
+  <itemDefinition id="_itemListItem" structureRef="java.util.List"/>
+
+  <process processType="Private" isExecutable="true" id="MiParentProcess"

Review Comment:
   Even though only used for tests, I think ideally to manually invoke this in a business service `processType="Public"`



##########
kogito-jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/ForEachParallelSubProcessAsyncTest.java:
##########
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jbpm.bpmn2;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.jbpm.bpmn2.foreach.MiChildProcessProcess;
+import org.jbpm.bpmn2.foreach.MiParentProcessModel;
+import org.jbpm.bpmn2.foreach.MiParentProcessProcess;
+import org.jbpm.test.utils.ProcessTestHelper;
+import org.junit.jupiter.api.Test;
+import org.kie.api.event.process.ProcessStartedEvent;
+import org.kie.kogito.Application;
+import org.kie.kogito.internal.process.event.DefaultKogitoProcessEventListener;
+import org.kie.kogito.internal.process.runtime.KogitoProcessInstance;
+import org.kie.kogito.process.ProcessInstance;
+import org.kie.kogito.process.workitems.impl.DefaultKogitoWorkItemHandler;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Tests that a parallel multi-instance call activity whose child subprocess
+ * contains an async node (e.g. a {@code customAsync} script task) and wait-state
+ * user tasks launches all child instances in parallel, rather than falling back
+ * to sequential execution.
+ *
+ * <p>
+ * Previously, {@code ForEachNodeInstance} fell back to sequential mode when
+ * child instances contained asynchronous nodes.
+ */
+public class ForEachParallelSubProcessAsyncTest {
+
+    @Test
+    public void testParallelMISubProcessWithAsyncNodeCreatesAllChildInstancesUpFront() {
+        Application app = ProcessTestHelper.newApplication();
+        ProcessTestHelper.registerHandler(app, "Human Task", new DefaultKogitoWorkItemHandler());
+
+        final List<String> childInstanceIds = new ArrayList<>();
+        ProcessTestHelper.registerProcessEventListener(app, new DefaultKogitoProcessEventListener() {
+            @Override
+            public void beforeProcessStarted(ProcessStartedEvent event) {
+                if ("MiChildProcess".equals(event.getProcessInstance().getProcessId())) {
+                    childInstanceIds.add(((KogitoProcessInstance) event.getProcessInstance()).getStringId());
+                }
+            }
+        });
+
+        MiChildProcessProcess.newProcess(app);
+        org.kie.kogito.process.Process<MiParentProcessModel> parentProcess = MiParentProcessProcess.newProcess(app);

Review Comment:
   Nitpick: I think to be clean let's use import instead of fully qualified package name



-- 
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-unsubscribe@kie.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org