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

fjtiradosarti pushed a commit to branch main
in repository 
https://gitbox.apache.org/repos/asf/incubator-kie-kogito-runtimes.git


The following commit(s) were added to refs/heads/main by this push:
     new 86b0d62cd2 Adding new dynamic addon (#3611)
86b0d62cd2 is described below

commit 86b0d62cd22abfedbe5ddbe625ba67ff18ae7eae
Author: Francisco Javier Tirado Sarti 
<[email protected]>
AuthorDate: Wed Aug 14 11:58:46 2024 +0200

    Adding new dynamic addon (#3611)
    
    * Adding new dynamic addon
    
    * [Fix #3615] Moving common stuff to common addons
---
 addons/common/pom.xml                              |  1 +
 addons/common/process-dynamic/pom.xml              | 43 ++++++++++
 .../process/dynamic/DynamicPathParamResolver.java  | 37 +++++++++
 .../dynamic/ProcessInstanceDynamicCallHelper.java  | 83 +++++++++++++++++++
 .../kie/kogito/process/dynamic/RestCallInfo.java   | 95 ++++++++++++++++++++++
 .../dynamic/WorkItemHandlerResultHolder.java       | 41 ++++++++++
 .../workflow/instance/impl/NodeInstanceImpl.java   |  3 +
 .../instance/impl/WorkflowProcessInstanceImpl.java |  7 +-
 .../jbpm/workflow/instance/node/DynamicUtils.java  | 41 +++++-----
 kogito-bom/pom.xml                                 | 34 ++++++++
 .../kogito/workitem/rest/RestWorkItemHandler.java  |  9 +-
 .../pathresolvers/DefaultPathParamResolver.java    |  6 +-
 quarkus/addons/dynamic/deployment/pom.xml          | 77 ++++++++++++++++++
 .../deployment/ProcessDynamicProcessor.java        | 39 +++++++++
 quarkus/addons/dynamic/integration-tests/pom.xml   | 61 ++++++++++++++
 .../process/dynamic/ResumeProcessResource.java     | 71 ++++++++++++++++
 .../src/main/resources/application.properties      |  7 ++
 .../src/main/resources/waitEvent.sw.json           | 33 ++++++++
 .../process/dynamic/DynamicCallResourceTest.java   | 71 ++++++++++++++++
 quarkus/addons/dynamic/pom.xml                     | 42 ++++++++++
 quarkus/addons/dynamic/runtime/pom.xml             | 91 +++++++++++++++++++++
 .../ProcessInstanceDynamicCallsResource.java       | 64 +++++++++++++++
 .../runtime/src/main/resources/META-INF/beans.xml  | 20 +++++
 .../src/main/resources/META-INF/kogito.addon       |  1 +
 .../main/resources/META-INF/quarkus-extension.yaml | 32 ++++++++
 quarkus/addons/pom.xml                             |  1 +
 26 files changed, 983 insertions(+), 27 deletions(-)

diff --git a/addons/common/pom.xml b/addons/common/pom.xml
index 35d262844c..6ac076d796 100644
--- a/addons/common/pom.xml
+++ b/addons/common/pom.xml
@@ -41,6 +41,7 @@
     <module>rest-exception-handler</module>
     <module>process-svg</module>
     <module>process-management</module>
+    <module>process-dynamic</module>
     <module>knative</module>
     <module>kubernetes</module>
     <module>kubernetes-service-catalog</module>
diff --git a/addons/common/process-dynamic/pom.xml 
b/addons/common/process-dynamic/pom.xml
new file mode 100644
index 0000000000..35e3a6ae36
--- /dev/null
+++ b/addons/common/process-dynamic/pom.xml
@@ -0,0 +1,43 @@
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.kie</groupId>
+    <artifactId>kogito-addons-common-parent</artifactId>
+    <version>999-SNAPSHOT</version>
+  </parent>
+  <artifactId>kie-addons-process-dynamic</artifactId>
+  <name>KIE Add-On Process Instance Dynamic Calls</name>
+  <description>Allow performing dynamic calls for existing process 
instances</description>
+  <properties>
+    <java.module.name>org.kie.process.dynamic</java.module.name>
+  </properties>
+  <dependencies>
+  
+    <dependency>
+      <groupId>org.kie.kogito</groupId>
+      <artifactId>kogito-rest-workitem</artifactId>
+    </dependency>
+  </dependencies> 
+</project>
\ No newline at end of file
diff --git 
a/addons/common/process-dynamic/src/main/java/org/kie/kogito/process/dynamic/DynamicPathParamResolver.java
 
b/addons/common/process-dynamic/src/main/java/org/kie/kogito/process/dynamic/DynamicPathParamResolver.java
new file mode 100644
index 0000000000..b6a0580e86
--- /dev/null
+++ 
b/addons/common/process-dynamic/src/main/java/org/kie/kogito/process/dynamic/DynamicPathParamResolver.java
@@ -0,0 +1,37 @@
+/*
+ * 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.kie.kogito.process.dynamic;
+
+import java.util.Map;
+
+import org.kogito.workitem.rest.pathresolvers.DefaultPathParamResolver;
+
+public class DynamicPathParamResolver extends DefaultPathParamResolver {
+
+    private String processInstanceId;
+
+    public DynamicPathParamResolver(String processInstanceId) {
+        this.processInstanceId = processInstanceId;
+    }
+
+    @Override
+    protected Object getParam(Map<String, Object> parameters, String key) {
+        return key.equals("processInstanceId") ? this.processInstanceId : 
super.getParam(parameters, key);
+    }
+}
diff --git 
a/addons/common/process-dynamic/src/main/java/org/kie/kogito/process/dynamic/ProcessInstanceDynamicCallHelper.java
 
b/addons/common/process-dynamic/src/main/java/org/kie/kogito/process/dynamic/ProcessInstanceDynamicCallHelper.java
new file mode 100644
index 0000000000..f4315135fb
--- /dev/null
+++ 
b/addons/common/process-dynamic/src/main/java/org/kie/kogito/process/dynamic/ProcessInstanceDynamicCallHelper.java
@@ -0,0 +1,83 @@
+/*
+ * 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.kie.kogito.process.dynamic;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.stream.Stream;
+
+import org.drools.core.common.InternalKnowledgeRuntime;
+import org.jbpm.process.instance.InternalProcessRuntime;
+import org.jbpm.process.instance.KogitoProcessContextImpl;
+import org.jbpm.process.instance.ProcessInstance;
+import org.jbpm.util.ContextFactory;
+import org.jbpm.workflow.core.impl.WorkflowProcessImpl;
+import org.jbpm.workflow.instance.WorkflowProcessInstance;
+import org.jbpm.workflow.instance.node.DynamicUtils;
+import org.kie.kogito.Model;
+import org.kie.kogito.process.Process;
+import org.kie.kogito.process.expr.ExpressionHandlerFactory;
+import org.kie.kogito.process.impl.AbstractProcessInstance;
+import org.kogito.workitem.rest.RestWorkItemHandler;
+
+public class ProcessInstanceDynamicCallHelper {
+
+    private ProcessInstanceDynamicCallHelper() {
+    }
+
+    public static void executeRestCall(RestWorkItemHandler handler, 
Stream<Process<?>> processes, String processId, String processInstanceId, 
RestCallInfo input) {
+        Process<?> processDef = processes.filter(p -> 
p.id().equals(processId)).findAny().orElseThrow(() -> new 
IllegalArgumentException("Cannot find process " + processId));
+        WorkflowProcessInstance pi = (WorkflowProcessInstance) 
findProcessInstance(processDef, processInstanceId);
+        WorkflowProcessImpl process = (WorkflowProcessImpl) pi.getProcess();
+        if (!process.isDynamic()) {
+            process.setDynamic(true);
+        }
+        InternalKnowledgeRuntime runtime = pi.getKnowledgeRuntime();
+        
InternalProcessRuntime.asKogitoProcessRuntime(runtime).getKogitoWorkItemManager().registerWorkItemHandler(RestWorkItemHandler.REST_TASK_TYPE,
 handler);
+        Map<String, Object> parameters = input.getArguments() == null ? new 
HashMap<>() : new HashMap<>(input.getArguments());
+        if (input.getHost() != null) {
+            parameters.put(RestWorkItemHandler.HOST, input.getHost());
+        }
+        if (input.getPort() != null) {
+            parameters.put(RestWorkItemHandler.PORT, input.getPort());
+        }
+        if (input.getMethod() != null) {
+            parameters.put(RestWorkItemHandler.METHOD, input.getMethod());
+        }
+        if (input.getEndpoint() != null) {
+            parameters.put(RestWorkItemHandler.URL, input.getEndpoint());
+        }
+        parameters.put(RestWorkItemHandler.PATH_PARAM_RESOLVER, new 
DynamicPathParamResolver(processInstanceId));
+        WorkItemHandlerResultHolder holder = new WorkItemHandlerResultHolder();
+        parameters.put(RestWorkItemHandler.RESULT_HANDLER, holder);
+        KogitoProcessContextImpl context = 
ContextFactory.fromItem(DynamicUtils.addDynamicWorkItem(pi, runtime, 
RestWorkItemHandler.REST_TASK_TYPE, parameters));
+        Model model = ((Model) processDef.createModel());
+        model.update(input.getOutputExpression() != null
+                ? 
ExpressionHandlerFactory.get(input.getOutputExpressionLang(), 
input.getOutputExpression()).eval(holder.getResult(), Map.class, context)
+                : holder.getResult());
+        ((AbstractProcessInstance) 
pi.unwrap()).updateVariablesPartially(model);
+    }
+
+    private static ProcessInstance findProcessInstance(Process<?> process, 
String processInstanceId) {
+        return process.instances()
+                
.findById(processInstanceId).map(AbstractProcessInstance.class::cast)
+                .map(AbstractProcessInstance::internalGetProcessInstance)
+                .orElseThrow(() -> new IllegalArgumentException("Cannot find 
process instance " + processInstanceId + " for process " + process.id()));
+    }
+}
diff --git 
a/addons/common/process-dynamic/src/main/java/org/kie/kogito/process/dynamic/RestCallInfo.java
 
b/addons/common/process-dynamic/src/main/java/org/kie/kogito/process/dynamic/RestCallInfo.java
new file mode 100644
index 0000000000..e6a0a14490
--- /dev/null
+++ 
b/addons/common/process-dynamic/src/main/java/org/kie/kogito/process/dynamic/RestCallInfo.java
@@ -0,0 +1,95 @@
+/*
+ * 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.kie.kogito.process.dynamic;
+
+import java.util.Map;
+
+public class RestCallInfo {
+
+    private String endpoint;
+    private String host;
+    private Integer port;
+    private String method;
+    private Map<String, Object> arguments;
+    private String outputExpression;
+    private String outputExpressionLang = "jq";
+
+    public String getEndpoint() {
+        return endpoint;
+    }
+
+    public void setEndpoint(String endpoint) {
+        this.endpoint = endpoint;
+    }
+
+    public String getHost() {
+        return host;
+    }
+
+    public void setHost(String host) {
+        this.host = host;
+    }
+
+    public Integer getPort() {
+        return port;
+    }
+
+    public void setPort(Integer port) {
+        this.port = port;
+    }
+
+    public String getMethod() {
+        return method;
+    }
+
+    public void setMethod(String method) {
+        this.method = method;
+    }
+
+    public Map<String, Object> getArguments() {
+        return arguments;
+    }
+
+    public void setArguments(Map<String, Object> arguments) {
+        this.arguments = arguments;
+    }
+
+    public String getOutputExpression() {
+        return outputExpression;
+    }
+
+    public void setOutputExpression(String outputExpression) {
+        this.outputExpression = outputExpression;
+    }
+
+    public String getOutputExpressionLang() {
+        return outputExpressionLang;
+    }
+
+    public void setOutputExpressionLang(String outputExpressionLang) {
+        this.outputExpressionLang = outputExpressionLang;
+    }
+
+    @Override
+    public String toString() {
+        return "RestCallInfo [endpoint=" + endpoint + ", host=" + host + ", 
port=" + port + ", method=" + method
+                + ", arguments=" + arguments + ", outputExpression=" + 
outputExpression + ", outputExpressionLang="
+                + outputExpressionLang + "]";
+    }
+}
diff --git 
a/addons/common/process-dynamic/src/main/java/org/kie/kogito/process/dynamic/WorkItemHandlerResultHolder.java
 
b/addons/common/process-dynamic/src/main/java/org/kie/kogito/process/dynamic/WorkItemHandlerResultHolder.java
new file mode 100644
index 0000000000..620526f71d
--- /dev/null
+++ 
b/addons/common/process-dynamic/src/main/java/org/kie/kogito/process/dynamic/WorkItemHandlerResultHolder.java
@@ -0,0 +1,41 @@
+/*
+ * 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.kie.kogito.process.dynamic;
+
+import java.util.Map;
+
+import org.kogito.workitem.rest.resulthandlers.RestWorkItemHandlerResult;
+
+import io.vertx.mutiny.core.buffer.Buffer;
+import io.vertx.mutiny.ext.web.client.HttpResponse;
+
+public class WorkItemHandlerResultHolder implements RestWorkItemHandlerResult {
+
+    private Map<String, Object> result;
+
+    @Override
+    public Object apply(HttpResponse<Buffer> buffer, Class<?> clazz) {
+        result = buffer.bodyAsJson(Map.class);
+        return result;
+    }
+
+    public Map<String, Object> getResult() {
+        return result;
+    }
+}
diff --git 
a/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/impl/NodeInstanceImpl.java
 
b/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/impl/NodeInstanceImpl.java
index a5e452a24a..fb73d73c00 100755
--- 
a/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/impl/NodeInstanceImpl.java
+++ 
b/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/impl/NodeInstanceImpl.java
@@ -161,6 +161,9 @@ public abstract class NodeInstanceImpl implements 
org.jbpm.workflow.instance.Nod
 
     @Override
     public org.kie.api.definition.process.Node getNode() {
+        if (nodeId == null) {
+            return null;
+        }
         try {
             return ((org.jbpm.workflow.core.NodeContainer) 
this.nodeInstanceContainer.getNodeContainer()).internalGetNode(this.nodeId);
         } catch (IllegalArgumentException e) {
diff --git 
a/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/impl/WorkflowProcessInstanceImpl.java
 
b/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/impl/WorkflowProcessInstanceImpl.java
index 5f67bf1957..c604312a8c 100755
--- 
a/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/impl/WorkflowProcessInstanceImpl.java
+++ 
b/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/impl/WorkflowProcessInstanceImpl.java
@@ -288,9 +288,12 @@ public abstract class WorkflowProcessInstanceImpl extends 
ProcessInstanceImpl im
     }
 
     public List<NodeInstance> getNodeInstances(WorkflowElementIdentifier 
nodeId, final List<NodeInstance> currentView) {
+        if (nodeId == null) {
+            return Collections.emptyList();
+        }
         List<NodeInstance> result = new ArrayList<>();
         for (final NodeInstance nodeInstance : currentView) {
-            if (nodeInstance.getNodeId().equals(nodeId)) {
+            if (nodeId.equals(nodeInstance.getNodeId())) {
                 result.add(nodeInstance);
             }
         }
@@ -712,7 +715,7 @@ public abstract class WorkflowProcessInstanceImpl extends 
ProcessInstanceImpl im
                             }
                             nodeInstance.trigger(null, 
Node.CONNECTION_DEFAULT_TYPE);
                         } else if (node instanceof CompositeNode) {
-                            Optional<NodeInstance> instance = 
this.nodeInstances.stream().filter(ni -> 
ni.getNodeId().equals(node.getId())).findFirst();
+                            Optional<NodeInstance> instance = 
this.nodeInstances.stream().filter(ni -> Objects.equals(ni.getNodeId(), 
node.getId())).findFirst();
                             instance.ifPresent(n -> ((CompositeNodeInstance) 
n).signalEvent(type, event));
                         }
                     }
diff --git 
a/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/node/DynamicUtils.java
 
b/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/node/DynamicUtils.java
index f7b0f23ab2..5c11434bf9 100755
--- 
a/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/node/DynamicUtils.java
+++ 
b/jbpm/jbpm-flow/src/main/java/org/jbpm/workflow/instance/node/DynamicUtils.java
@@ -51,6 +51,7 @@ import org.kie.internal.runtime.StatefulKnowledgeSession;
 import org.kie.kogito.internal.process.event.KogitoProcessEventSupport;
 import org.kie.kogito.internal.process.runtime.KogitoProcessInstance;
 import org.kie.kogito.internal.process.runtime.KogitoProcessRuntime;
+import org.kie.kogito.internal.process.runtime.KogitoWorkItem;
 import org.kie.kogito.process.workitems.InternalKogitoWorkItemManager;
 import org.kie.kogito.process.workitems.impl.KogitoWorkItemImpl;
 import org.slf4j.Logger;
@@ -75,19 +76,19 @@ public class DynamicUtils {
                 parameters);
     }
 
-    public static void addDynamicWorkItem(
+    public static KogitoWorkItem addDynamicWorkItem(
             final org.kie.api.runtime.process.ProcessInstance 
dynamicProcessInstance,
             KieRuntime ksession,
             String workItemName,
             Map<String, Object> parameters) {
-        internalAddDynamicWorkItem((WorkflowProcessInstance) 
dynamicProcessInstance,
+        return internalAddDynamicWorkItem((WorkflowProcessInstance) 
dynamicProcessInstance,
                 null,
                 ksession,
                 workItemName,
                 parameters);
     }
 
-    private static void internalAddDynamicWorkItem(
+    private static KogitoWorkItem internalAddDynamicWorkItem(
             final WorkflowProcessInstance processInstance,
             final DynamicNodeInstance dynamicContext,
             KieRuntime ksession,
@@ -134,14 +135,7 @@ public class DynamicUtils {
         workItemNodeInstance.setMetaData("NodeType",
                 workItemName);
         workItem.setNodeInstanceId(workItemNodeInstance.getStringId());
-        if (ksession instanceof StatefulKnowledgeSession) {
-            workItemNodeInstance.setProcessInstance(processInstance);
-            workItemNodeInstance.setNodeInstanceContainer(dynamicContext == 
null ? processInstance : dynamicContext);
-            workItemNodeInstance.addEventListeners();
-            executeWorkItem((StatefulKnowledgeSession) ksession,
-                    workItem,
-                    workItemNodeInstance);
-        } else if (ksession instanceof CommandBasedStatefulKnowledgeSession) {
+        if (ksession instanceof CommandBasedStatefulKnowledgeSession) {
             ExecutableRunner runner = ((CommandBasedStatefulKnowledgeSession) 
ksession).getRunner();
             runner.execute(new ExecutableCommand<Void>() {
                 private static final long serialVersionUID = 5L;
@@ -164,11 +158,18 @@ public class DynamicUtils {
                 }
             });
         } else {
-            throw new IllegalArgumentException("Unsupported ksession: " + 
(ksession == null ? "null" : ksession.getClass().getName()));
+            workItemNodeInstance.setProcessInstance(processInstance);
+            workItemNodeInstance.setNodeInstanceContainer(dynamicContext == 
null ? processInstance : dynamicContext);
+            workItemNodeInstance.addEventListeners();
+            executeWorkItem(ksession,
+                    workItem,
+                    workItemNodeInstance);
+
         }
+        return workItem;
     }
 
-    private static void executeWorkItem(StatefulKnowledgeSession ksession,
+    private static void executeWorkItem(KieRuntime ksession,
             KogitoWorkItemImpl workItem,
             WorkItemNodeInstance workItemNodeInstance) {
         KogitoProcessRuntime kruntime = asKogitoProcessRuntime(ksession);
@@ -225,13 +226,7 @@ public class DynamicUtils {
         subProcessNodeInstance.setProcessInstance(processInstance);
         subProcessNodeInstance.setMetaData("NodeType",
                 "SubProcessNode");
-        if (ksession instanceof StatefulKnowledgeSession) {
-            return executeSubProcess(asKogitoProcessRuntime(ksession),
-                    processId,
-                    parameters,
-                    processInstance,
-                    subProcessNodeInstance);
-        } else if (ksession instanceof CommandBasedStatefulKnowledgeSession) {
+        if (ksession instanceof CommandBasedStatefulKnowledgeSession) {
             ExecutableRunner commandService = 
((CommandBasedStatefulKnowledgeSession) ksession).getRunner();
             return commandService.execute(new ExecutableCommand<String>() {
                 private static final long serialVersionUID = 5L;
@@ -256,7 +251,11 @@ public class DynamicUtils {
                 }
             });
         } else {
-            throw new IllegalArgumentException("Unsupported ksession: " + 
(ksession == null ? "null" : ksession.getClass().getName()));
+            return executeSubProcess(asKogitoProcessRuntime(ksession),
+                    processId,
+                    parameters,
+                    processInstance,
+                    subProcessNodeInstance);
         }
     }
 
diff --git a/kogito-bom/pom.xml b/kogito-bom/pom.xml
index b0bd002072..a8ac56322d 100755
--- a/kogito-bom/pom.xml
+++ b/kogito-bom/pom.xml
@@ -1214,6 +1214,40 @@
         <version>${project.version}</version>
         <classifier>sources</classifier>
       </dependency>
+      
+      <dependency>
+        <groupId>org.kie</groupId>
+        <artifactId>kie-addons-process-dynamic</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.kie</groupId>
+        <artifactId>kie-addons-process-dynamic</artifactId>
+        <version>${project.version}</version>
+        <classifier>sources</classifier>
+      </dependency>
+      <dependency>
+        <groupId>org.kie</groupId>
+        <artifactId>kie-addons-quarkus-process-dynamic</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.kie</groupId>
+        <artifactId>kie-addons-quarkus-process-dynamic</artifactId>
+        <version>${project.version}</version>
+        <classifier>sources</classifier>
+      </dependency>
+      <dependency>
+        <groupId>org.kie</groupId>
+        <artifactId>kie-addons-quarkus-process-dynamic-deployment</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.kie</groupId>
+        <artifactId>kie-addons-quarkus-process-dynamic-deployment</artifactId>
+        <version>${project.version}</version>
+        <classifier>sources</classifier>
+      </dependency>
 
       <dependency>
         <groupId>org.kie</groupId>
diff --git 
a/kogito-workitems/kogito-rest-workitem/src/main/java/org/kogito/workitem/rest/RestWorkItemHandler.java
 
b/kogito-workitems/kogito-rest-workitem/src/main/java/org/kogito/workitem/rest/RestWorkItemHandler.java
index 279daa331d..6ef7cfb899 100644
--- 
a/kogito-workitems/kogito-rest-workitem/src/main/java/org/kogito/workitem/rest/RestWorkItemHandler.java
+++ 
b/kogito-workitems/kogito-rest-workitem/src/main/java/org/kogito/workitem/rest/RestWorkItemHandler.java
@@ -213,9 +213,12 @@ public class RestWorkItemHandler implements 
KogitoWorkItemHandler {
     }
 
     private Class<?> getTargetInfo(KogitoWorkItem workItem) {
-        String varName = ((WorkItemNode) ((WorkItemNodeInstance) 
workItem.getNodeInstance()).getNode()).getIoSpecification().getOutputMappingBySources().get(RESULT);
-        if (varName != null) {
-            return getType(workItem, varName);
+        WorkItemNode node = (WorkItemNode) ((WorkItemNodeInstance) 
workItem.getNodeInstance()).getNode();
+        if (node != null) {
+            String varName = 
node.getIoSpecification().getOutputMappingBySources().get(RESULT);
+            if (varName != null) {
+                return getType(workItem, varName);
+            }
         }
         logger.warn("no out mapping for {}", RESULT);
         return null;
diff --git 
a/kogito-workitems/kogito-rest-workitem/src/main/java/org/kogito/workitem/rest/pathresolvers/DefaultPathParamResolver.java
 
b/kogito-workitems/kogito-rest-workitem/src/main/java/org/kogito/workitem/rest/pathresolvers/DefaultPathParamResolver.java
index 6f9f5e29a1..b9caf37ec5 100644
--- 
a/kogito-workitems/kogito-rest-workitem/src/main/java/org/kogito/workitem/rest/pathresolvers/DefaultPathParamResolver.java
+++ 
b/kogito-workitems/kogito-rest-workitem/src/main/java/org/kogito/workitem/rest/pathresolvers/DefaultPathParamResolver.java
@@ -40,7 +40,7 @@ public class DefaultPathParamResolver implements 
PathParamResolver {
                 throw new IllegalArgumentException("malformed endpoint should 
contain enclosing '}' " + endPoint);
             }
             final String key = sb.substring(start + 1, end);
-            final Object value = parameters.get(key);
+            final Object value = getParam(parameters, key);
             if (value == null) {
                 throw new IllegalArgumentException("missing parameter " + key);
             }
@@ -51,4 +51,8 @@ public class DefaultPathParamResolver implements 
PathParamResolver {
         parameters.keySet().removeAll(toRemove);
         return sb.toString();
     }
+
+    protected Object getParam(Map<String, Object> parameters, String key) {
+        return parameters.get(key);
+    }
 }
diff --git a/quarkus/addons/dynamic/deployment/pom.xml 
b/quarkus/addons/dynamic/deployment/pom.xml
new file mode 100644
index 0000000000..7c4332e4de
--- /dev/null
+++ b/quarkus/addons/dynamic/deployment/pom.xml
@@ -0,0 +1,77 @@
+<?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.
+
+-->
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
https://maven.apache.org/xsd/maven-4.0.0.xsd";
+         xmlns="http://maven.apache.org/POM/4.0.0";>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.kie</groupId>
+    <artifactId>kie-addons-quarkus-process-dynamic-parent</artifactId>
+    <version>999-SNAPSHOT</version>
+  </parent>
+  <artifactId>kie-addons-quarkus-process-dynamic-deployment</artifactId>
+  <name>KIE Add-On Process Instance Dynamic Calls - Deployment</name>
+
+  <properties>
+    
<java.module.name>org.kie.kogito.process.quarkus.dynamic.deployment</java.module.name>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.kie</groupId>
+      <artifactId>kie-addons-quarkus-process-dynamic</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.kie</groupId>
+      <artifactId>kogito-addons-quarkus-common-deployment</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>io.quarkus</groupId>
+      <artifactId>quarkus-resteasy-deployment</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>io.quarkus</groupId>
+      <artifactId>quarkus-resteasy-jackson-deployment</artifactId>
+       <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>io.quarkus</groupId>
+      <artifactId>quarkus-arc-deployment</artifactId>
+    </dependency>
+   </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <annotationProcessorPaths>
+            <path>
+              <groupId>io.quarkus</groupId>
+              <artifactId>quarkus-extension-processor</artifactId>
+             <version>${version.io.quarkus}</version>
+            </path>
+          </annotationProcessorPaths>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git 
a/quarkus/addons/dynamic/deployment/src/main/java/org/kie/kogito/process/dynamic/deployment/ProcessDynamicProcessor.java
 
b/quarkus/addons/dynamic/deployment/src/main/java/org/kie/kogito/process/dynamic/deployment/ProcessDynamicProcessor.java
new file mode 100644
index 0000000000..c5c3818bb2
--- /dev/null
+++ 
b/quarkus/addons/dynamic/deployment/src/main/java/org/kie/kogito/process/dynamic/deployment/ProcessDynamicProcessor.java
@@ -0,0 +1,39 @@
+/*
+ * 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.kie.kogito.process.dynamic.deployment;
+
+import org.kie.kogito.quarkus.addons.common.deployment.KogitoCapability;
+import 
org.kie.kogito.quarkus.addons.common.deployment.OneOfCapabilityKogitoAddOnProcessor;
+
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+
+class ProcessDynamicProcessor extends OneOfCapabilityKogitoAddOnProcessor {
+
+    private static final String FEATURE = 
"kie-addon-process-dynamic-extension";
+
+    ProcessDynamicProcessor() {
+        super(KogitoCapability.SERVERLESS_WORKFLOW);
+    }
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+}
diff --git a/quarkus/addons/dynamic/integration-tests/pom.xml 
b/quarkus/addons/dynamic/integration-tests/pom.xml
new file mode 100644
index 0000000000..4fe89ac815
--- /dev/null
+++ b/quarkus/addons/dynamic/integration-tests/pom.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.kie</groupId>
+    <artifactId>kie-addons-quarkus-process-dynamic-parent</artifactId>
+    <version>999-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>kie-addons-quarkus-process-dynamic-integration-tests</artifactId>
+  <name>KIE Add-On Process Instance Dynamic Calls Integration test</name>
+
+  <properties>
+    
<java.module.name>org.kie.kogito.process.quarkus.dynamic.tests</java.module.name>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.kie.sonataflow</groupId>
+      <artifactId>sonataflow-quarkus</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.kie</groupId>
+      <artifactId>kie-addons-quarkus-process-dynamic</artifactId>
+     </dependency>
+     <dependency>
+       <groupId>io.quarkus</groupId>
+       <artifactId>quarkus-resteasy</artifactId>
+    </dependency>
+     <dependency>
+       <groupId>io.quarkus</groupId>
+       <artifactId>quarkus-resteasy-jackson</artifactId>
+    </dependency>
+     <dependency>
+      <groupId>io.quarkus</groupId>
+      <artifactId>quarkus-junit5</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>io.rest-assured</groupId>
+      <artifactId>rest-assured</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>io.quarkus</groupId>
+        <artifactId>quarkus-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>build</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git 
a/quarkus/addons/dynamic/integration-tests/src/main/java/org/kie/kogito/process/dynamic/ResumeProcessResource.java
 
b/quarkus/addons/dynamic/integration-tests/src/main/java/org/kie/kogito/process/dynamic/ResumeProcessResource.java
new file mode 100644
index 0000000000..9447ecd220
--- /dev/null
+++ 
b/quarkus/addons/dynamic/integration-tests/src/main/java/org/kie/kogito/process/dynamic/ResumeProcessResource.java
@@ -0,0 +1,71 @@
+/*
+ * 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.kie.kogito.process.dynamic;
+
+import java.io.IOException;
+import java.net.URI;
+import java.time.OffsetDateTime;
+import java.util.Map;
+import java.util.UUID;
+
+import org.eclipse.microprofile.reactive.messaging.Channel;
+import org.eclipse.microprofile.reactive.messaging.Emitter;
+import org.kie.kogito.event.CloudEventMarshaller;
+import org.kie.kogito.event.cloudevents.CloudEventExtensionConstants;
+import org.kie.kogito.event.impl.StringCloudEventMarshaller;
+import org.kie.kogito.jackson.utils.ObjectMapperFactory;
+
+import io.cloudevents.CloudEvent;
+import io.cloudevents.core.builder.CloudEventBuilder;
+
+import jakarta.annotation.PostConstruct;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+
+@Path("/example")
+public class ResumeProcessResource {
+
+    private CloudEventMarshaller<String> marshaller;
+    @Inject
+    @Channel("resume-out")
+    Emitter<String> resumeEmitter;
+
+    @PostConstruct
+    void init() {
+        marshaller = new StringCloudEventMarshaller(ObjectMapperFactory.get());
+    }
+
+    @POST
+    @Path("/{processInstanceId}")
+    public Map<String, Object> resumeProcess(@PathParam("processInstanceId") 
String processInstanceId, Map<String, Object> data) throws IOException {
+        
resumeEmitter.send(marshaller.marshall(buildCloudEvent(processInstanceId, 
data)));
+        return Map.of("message", "this is a test call to resume the workflow", 
"tobefilterout", "This a parameter we would like to remove");
+    }
+
+    private CloudEvent buildCloudEvent(String processInstanceId, Map<String, 
Object> data) {
+        return CloudEventBuilder.v1()
+                .withId(UUID.randomUUID().toString())
+                .withSource(URI.create(""))
+                .withType("resume")
+                .withTime(OffsetDateTime.now())
+                
.withData(marshaller.cloudEventDataFactory().apply(data)).withExtension(CloudEventExtensionConstants.PROCESS_REFERENCE_ID,
 processInstanceId).build();
+    }
+}
diff --git 
a/quarkus/addons/dynamic/integration-tests/src/main/resources/application.properties
 
b/quarkus/addons/dynamic/integration-tests/src/main/resources/application.properties
new file mode 100644
index 0000000000..a656b4c642
--- /dev/null
+++ 
b/quarkus/addons/dynamic/integration-tests/src/main/resources/application.properties
@@ -0,0 +1,7 @@
+mp.messaging.incoming.resume.connector=quarkus-http
+mp.messaging.incoming.resume.path=/resume
+
+mp.messaging.outgoing.resume-out.connector=quarkus-http
+mp.messaging.outgoing.resume-out.url=http://localhost:8081/resume
+
+quarkus.devservices.enabled = false
diff --git 
a/quarkus/addons/dynamic/integration-tests/src/main/resources/waitEvent.sw.json 
b/quarkus/addons/dynamic/integration-tests/src/main/resources/waitEvent.sw.json
new file mode 100644
index 0000000000..fd57e325f2
--- /dev/null
+++ 
b/quarkus/addons/dynamic/integration-tests/src/main/resources/waitEvent.sw.json
@@ -0,0 +1,33 @@
+{
+  "id": "dynamicWait",
+  "version": "1.0",
+  "name": "Test dynamic invocations",
+  "start": "doNothing",
+  "events": [
+    {
+      "name": "resumeEvent",
+      "source": "",
+      "type": "resume"
+    }
+  ],
+  "states": [  
+    {
+      "name": "doNothing",
+      "type": "operation",
+      "actions": [],
+      "transition": "waitForEvent"
+    }, 
+    {
+      "name": "waitForEvent",
+      "type": "event",
+       "onEvents": [
+        {
+          "eventRefs": [
+            "resumeEvent"
+          ]
+        }
+       ],
+      "end": true
+    }
+  ]
+}
\ No newline at end of file
diff --git 
a/quarkus/addons/dynamic/integration-tests/src/test/java/org/kie/kogito/process/dynamic/DynamicCallResourceTest.java
 
b/quarkus/addons/dynamic/integration-tests/src/test/java/org/kie/kogito/process/dynamic/DynamicCallResourceTest.java
new file mode 100644
index 0000000000..24c86b8e9e
--- /dev/null
+++ 
b/quarkus/addons/dynamic/integration-tests/src/test/java/org/kie/kogito/process/dynamic/DynamicCallResourceTest.java
@@ -0,0 +1,71 @@
+/*
+ * 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.kie.kogito.process.dynamic;
+
+import java.util.Map;
+
+import org.junit.jupiter.api.Test;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.http.ContentType;
+
+import static io.restassured.RestAssured.*;
+
+@QuarkusTest
+public class DynamicCallResourceTest {
+
+    @Test
+    void testDynamicCall() {
+
+        String id = given()
+                .contentType(ContentType.JSON)
+                .accept(ContentType.JSON)
+                .when()
+                .post("/dynamicWait")
+                .then()
+                .statusCode(201)
+                .extract().path("id");
+
+        given()
+                .contentType(ContentType.JSON)
+                .accept(ContentType.JSON)
+                .when()
+                .get("/dynamicWait/" + id)
+                .then()
+                .statusCode(200);
+
+        given()
+                .contentType(ContentType.JSON)
+                .accept(ContentType.JSON)
+                .body(Map.of("endpoint", "/example/{processInstanceId}", 
"port", 8081, "method", "post", "outputExpression", "{message}"))
+                .when()
+                .post("/_dynamic/dynamicWait/" + id + "/rest")
+                .then()
+                .statusCode(200);
+
+        given()
+                .contentType(ContentType.JSON)
+                .accept(ContentType.JSON)
+                .when()
+                .get("/dynamicWait/" + id)
+                .then()
+                .statusCode(404);
+    }
+
+}
diff --git a/quarkus/addons/dynamic/pom.xml b/quarkus/addons/dynamic/pom.xml
new file mode 100644
index 0000000000..cbaa99408c
--- /dev/null
+++ b/quarkus/addons/dynamic/pom.xml
@@ -0,0 +1,42 @@
+<?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.
+
+-->
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xmlns="http://maven.apache.org/POM/4.0.0";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <parent>
+    <artifactId>kogito-addons-quarkus-parent</artifactId>
+    <groupId>org.kie</groupId>
+    <version>999-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>kie-addons-quarkus-process-dynamic-parent</artifactId>
+  <name>KIE Add-On Process Instance Dynamic Call - Parent</name>
+  <packaging>pom</packaging>
+
+  <modules>
+    <module>deployment</module>
+    <module>runtime</module>
+    <module>integration-tests</module>
+  </modules>
+
+</project>
\ No newline at end of file
diff --git a/quarkus/addons/dynamic/runtime/pom.xml 
b/quarkus/addons/dynamic/runtime/pom.xml
new file mode 100644
index 0000000000..98c099d0d6
--- /dev/null
+++ b/quarkus/addons/dynamic/runtime/pom.xml
@@ -0,0 +1,91 @@
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.kie</groupId>
+    <artifactId>kie-addons-quarkus-process-dynamic-parent</artifactId>
+    <version>999-SNAPSHOT</version>
+  </parent>
+  <artifactId>kie-addons-quarkus-process-dynamic</artifactId>
+  <name>KIE Add-On Process Instance Dynamic Calls</name>
+  <description>Allow performing dynamic calls for existiing process instances 
in Quarkus</description>
+  <properties>
+    <java.module.name>org.kie.kogito.process.quarkus.dynamic</java.module.name>
+  </properties>
+  <dependencies>
+    <dependency>
+      <groupId>io.quarkus</groupId>
+      <artifactId>quarkus-arc</artifactId>
+    </dependency>
+    <dependency>
+       <groupId>io.quarkus</groupId>
+       <artifactId>quarkus-resteasy</artifactId>
+       <scope>provided</scope>
+    </dependency>
+     <dependency>
+       <groupId>io.quarkus</groupId>
+       <artifactId>quarkus-resteasy-jackson</artifactId>
+       <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.kie</groupId>
+      <artifactId>kie-addons-process-dynamic</artifactId>
+    </dependency>
+   </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>io.quarkus</groupId>
+        <artifactId>quarkus-extension-maven-plugin</artifactId>
+        <version>${version.io.quarkus}</version>
+        <executions>
+          <execution>
+            <phase>compile</phase>
+            <goals>
+              <goal>extension-descriptor</goal>
+            </goals>
+            <configuration>
+              
<deployment>${project.groupId}:${project.artifactId}-deployment:${project.version}</deployment>
+              <capabilities>
+                <provides>org.kie.addons.process.definitions</provides>
+              </capabilities>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <annotationProcessorPaths>
+            <path>
+              <groupId>io.quarkus</groupId>
+              <artifactId>quarkus-extension-processor</artifactId>
+             <version>${version.io.quarkus}</version>
+            </path>
+          </annotationProcessorPaths>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file
diff --git 
a/quarkus/addons/dynamic/runtime/src/main/java/org/kie/kogito/process/dynamic/ProcessInstanceDynamicCallsResource.java
 
b/quarkus/addons/dynamic/runtime/src/main/java/org/kie/kogito/process/dynamic/ProcessInstanceDynamicCallsResource.java
new file mode 100644
index 0000000000..6729a5c1ac
--- /dev/null
+++ 
b/quarkus/addons/dynamic/runtime/src/main/java/org/kie/kogito/process/dynamic/ProcessInstanceDynamicCallsResource.java
@@ -0,0 +1,64 @@
+/*
+ * 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.kie.kogito.process.dynamic;
+
+import org.kie.kogito.process.Process;
+import org.kogito.workitem.rest.RestWorkItemHandler;
+
+import io.vertx.ext.web.client.WebClientOptions;
+import io.vertx.mutiny.core.Vertx;
+import io.vertx.mutiny.ext.web.client.WebClient;
+
+import jakarta.annotation.PostConstruct;
+import jakarta.enterprise.inject.Instance;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
+
+@Path("/_dynamic")
+public class ProcessInstanceDynamicCallsResource {
+
+    @Inject
+    Instance<Process<?>> processes;
+    @Inject
+    Vertx vertx;
+    @Inject
+    WebClientOptions sslOptions;
+    private RestWorkItemHandler handler;
+
+    @PostConstruct
+    void init() {
+        handler = new RestWorkItemHandler(WebClient.create(vertx), 
WebClient.create(vertx, sslOptions));
+    }
+
+    @POST
+    @Produces(MediaType.APPLICATION_JSON)
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Path("/{processId}/{processInstanceId}/rest")
+    public Response executeRestCall(@PathParam("processId") String processId, 
@PathParam("processInstanceId") String processInstanceId, RestCallInfo input) {
+        ProcessInstanceDynamicCallHelper.executeRestCall(handler, 
processes.stream(), processId, processInstanceId, input);
+        return Response.status(200).build();
+    }
+
+}
diff --git 
a/quarkus/addons/dynamic/runtime/src/main/resources/META-INF/beans.xml 
b/quarkus/addons/dynamic/runtime/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000000..a0eb9fbf8c
--- /dev/null
+++ b/quarkus/addons/dynamic/runtime/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,20 @@
+<!--
+
+    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.
+
+-->
diff --git 
a/quarkus/addons/dynamic/runtime/src/main/resources/META-INF/kogito.addon 
b/quarkus/addons/dynamic/runtime/src/main/resources/META-INF/kogito.addon
new file mode 100644
index 0000000000..079f19a788
--- /dev/null
+++ b/quarkus/addons/dynamic/runtime/src/main/resources/META-INF/kogito.addon
@@ -0,0 +1 @@
+process-dynamic
\ No newline at end of file
diff --git 
a/quarkus/addons/dynamic/runtime/src/main/resources/META-INF/quarkus-extension.yaml
 
b/quarkus/addons/dynamic/runtime/src/main/resources/META-INF/quarkus-extension.yaml
new file mode 100644
index 0000000000..3e108e13a7
--- /dev/null
+++ 
b/quarkus/addons/dynamic/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -0,0 +1,32 @@
+#
+# 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.
+#
+
+name: KIE Process Instance Dynamic Calls  Add-On
+description: Allow dynamic invocations over existing process instances
+metadata:
+  keywords:
+    - KIE
+    - processes
+    - process dynamic
+    - workflows
+  guide: https://quarkus.io/guides/kie
+  categories:
+    - "business-automation"
+    - "cloud"
+  status: "stable"
diff --git a/quarkus/addons/pom.xml b/quarkus/addons/pom.xml
index eb068baddb..6b27efb501 100644
--- a/quarkus/addons/pom.xml
+++ b/quarkus/addons/pom.xml
@@ -58,6 +58,7 @@
     <module>task-management</module>
     <module>marshallers</module>
     <module>process-definitions</module>
+    <module>dynamic</module>
   </modules>
 
   <profiles>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to