diff --git a/kogito-bom/pom.xml b/kogito-bom/pom.xml
index 66338065ebd..9f2b682d33b 100755
--- a/kogito-bom/pom.xml
+++ b/kogito-bom/pom.xml
@@ -1144,6 +1144,28 @@
${project.version}
sources
+
+ org.kie.kogito
+ kogito-addons-quarkus-process-definitions
+ ${project.version}
+
+
+ org.kie.kogito
+ kogito-addons-quarkus-process-definitions
+ ${project.version}
+ sources
+
+
+ org.kie.kogito
+ kogito-addons-quarkus-process-definitions-deployment
+ ${project.version}
+
+
+ org.kie.kogito
+ kogito-addons-quarkus-process-definitions-deployment
+ ${project.version}
+ sources
+
org.kie.kogito
diff --git a/quarkus/addons/process-definitions/deployment/pom.xml b/quarkus/addons/process-definitions/deployment/pom.xml
new file mode 100644
index 00000000000..f8c144a3b7b
--- /dev/null
+++ b/quarkus/addons/process-definitions/deployment/pom.xml
@@ -0,0 +1,52 @@
+
+
+ 4.0.0
+
+ org.kie.kogito
+ kogito-addons-quarkus-process-definitions-parent
+ 2.0.0-SNAPSHOT
+
+ kogito-addons-quarkus-process-definitions-deployment
+ Kogito Add-On Process Definitions - Deployment
+
+
+ org.kie.kogito
+ kogito-addons-quarkus-process-definitions
+
+
+ org.kie.kogito
+ kogito-addons-quarkus-common-deployment
+
+
+ io.quarkus
+ quarkus-resteasy-deployment
+ provided
+
+
+ io.quarkus
+ quarkus-resteasy-jackson-deployment
+ provided
+
+
+ io.quarkus
+ quarkus-arc-deployment
+
+
+
+
+
+ maven-compiler-plugin
+
+
+
+ io.quarkus
+ quarkus-extension-processor
+ ${version.io.quarkus}
+
+
+
+
+
+
+
diff --git a/quarkus/addons/process-definitions/deployment/src/main/java/org/kie/kogito/process/management/deployment/ProcessDefinitionsProcessor.java b/quarkus/addons/process-definitions/deployment/src/main/java/org/kie/kogito/process/management/deployment/ProcessDefinitionsProcessor.java
new file mode 100644
index 00000000000..44fa78024a1
--- /dev/null
+++ b/quarkus/addons/process-definitions/deployment/src/main/java/org/kie/kogito/process/management/deployment/ProcessDefinitionsProcessor.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2023 Red Hat, Inc. and/or its affiliates.
+ *
+ * Licensed 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.management.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 ProcessDefinitionsProcessor extends OneOfCapabilityKogitoAddOnProcessor {
+
+ private static final String FEATURE = "kogito-addon-process-definitions-extension";
+
+ ProcessDefinitionsProcessor() {
+ super(KogitoCapability.SERVERLESS_WORKFLOW);
+ }
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
+}
diff --git a/quarkus/addons/process-definitions/pom.xml b/quarkus/addons/process-definitions/pom.xml
new file mode 100644
index 00000000000..41a4dba47c1
--- /dev/null
+++ b/quarkus/addons/process-definitions/pom.xml
@@ -0,0 +1,21 @@
+
+
+
+ kogito-addons-quarkus-parent
+ org.kie.kogito
+ 2.0.0-SNAPSHOT
+
+ 4.0.0
+
+ kogito-addons-quarkus-process-definitions-parent
+ Kogito Add-On Process Deployment - Parent
+ pom
+
+
+ deployment
+ runtime
+
+
+
\ No newline at end of file
diff --git a/quarkus/addons/process-definitions/runtime/pom.xml b/quarkus/addons/process-definitions/runtime/pom.xml
new file mode 100644
index 00000000000..7bb3c6948f3
--- /dev/null
+++ b/quarkus/addons/process-definitions/runtime/pom.xml
@@ -0,0 +1,78 @@
+
+ 4.0.0
+
+ org.kie.kogito
+ kogito-addons-quarkus-process-definitions-parent
+ 2.0.0-SNAPSHOT
+
+ kogito-addons-quarkus-process-definitions
+ Kogito Add-On Process Definitions
+ Allow deploying process definitions for Quarkus
+
+
+
+ io.quarkus
+ quarkus-arc
+
+
+ io.quarkus
+ quarkus-resteasy
+ provided
+
+
+ io.quarkus
+ quarkus-resteasy-jackson
+ provided
+
+
+ org.kie.kogito
+ kogito-serverless-workflow-executor-core
+
+
+ io.quarkus
+ quarkus-junit5
+ test
+
+
+ io.rest-assured
+ rest-assured
+ test
+
+
+
+
+
+ io.quarkus
+ quarkus-bootstrap-maven-plugin
+
+
+ compile
+
+ extension-descriptor
+
+
+ ${project.groupId}:${project.artifactId}-deployment:${project.version}
+
+ org.kie.kogito.addons.process.definitions
+
+
+
+
+
+
+ maven-compiler-plugin
+
+
+
+ io.quarkus
+ quarkus-extension-processor
+ ${version.io.quarkus}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow/src/main/java/org/kie/kogito/serverless/workflow/KogitoGenericResource.java b/quarkus/addons/process-definitions/runtime/src/main/java/org/kie/kogito/process/definitions/ProcessDefinitionsResource.java
similarity index 82%
rename from quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow/src/main/java/org/kie/kogito/serverless/workflow/KogitoGenericResource.java
rename to quarkus/addons/process-definitions/runtime/src/main/java/org/kie/kogito/process/definitions/ProcessDefinitionsResource.java
index 40f5f3e0bb2..c27ce320ffb 100644
--- a/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow/src/main/java/org/kie/kogito/serverless/workflow/KogitoGenericResource.java
+++ b/quarkus/addons/process-definitions/runtime/src/main/java/org/kie/kogito/process/definitions/ProcessDefinitionsResource.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.kie.kogito.serverless.workflow;
+package org.kie.kogito.process.definitions;
import java.io.IOException;
import java.io.StringReader;
@@ -29,12 +29,15 @@
import javax.ws.rs.core.Response;
import org.kie.kogito.serverless.workflow.executor.StaticWorkflowApplication;
+import org.kie.kogito.serverless.workflow.models.JsonNodeModel;
import org.kie.kogito.serverless.workflow.models.JsonNodeModelInput;
import org.kie.kogito.serverless.workflow.utils.ServerlessWorkflowUtils;
import org.kie.kogito.serverless.workflow.utils.WorkflowFormat;
+import com.fasterxml.jackson.databind.node.NullNode;
+
@Path("/")
-public class KogitoGenericResource {
+public class ProcessDefinitionsResource {
private StaticWorkflowApplication application;
@@ -53,13 +56,16 @@ void cleanup() {
@Consumes(MediaType.APPLICATION_JSON)
@Path("{id}")
public Response executeProcess(@PathParam("id") String processId, JsonNodeModelInput input) {
- return Response.status(200).entity(
- application.execute(application.findProcessById(processId).orElseThrow(() -> new IllegalArgumentException("Cannot find process id " + processId)), input.toModel())).build();
+ return Response.status(201).entity(
+ application.execute(application.findProcessById(processId).orElseThrow(() -> new IllegalArgumentException("Cannot find process id " + processId)),
+ input != null ? input.toModel() : new JsonNodeModel(NullNode.instance)))
+ .build();
}
@POST
@Consumes(MediaType.TEXT_PLAIN)
- @Path("{id}/upload")
+ @Produces(MediaType.TEXT_PLAIN)
+ @Path("{id}/definition")
public Response uploadProcess(@PathParam("id") String processId, String content) throws IOException {
application.process(ServerlessWorkflowUtils.getWorkflow(new StringReader(content), content.startsWith("{") ? WorkflowFormat.JSON : WorkflowFormat.YAML));
return Response.ok().build();
diff --git a/quarkus/addons/process-definitions/runtime/src/main/resources/META-INF/beans.xml b/quarkus/addons/process-definitions/runtime/src/main/resources/META-INF/beans.xml
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/quarkus/addons/process-definitions/runtime/src/main/resources/META-INF/kogito.addon b/quarkus/addons/process-definitions/runtime/src/main/resources/META-INF/kogito.addon
new file mode 100644
index 00000000000..7e7542f566d
--- /dev/null
+++ b/quarkus/addons/process-definitions/runtime/src/main/resources/META-INF/kogito.addon
@@ -0,0 +1 @@
+process-definitions
\ No newline at end of file
diff --git a/quarkus/addons/process-definitions/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/quarkus/addons/process-definitions/runtime/src/main/resources/META-INF/quarkus-extension.yaml
new file mode 100644
index 00000000000..349078eab61
--- /dev/null
+++ b/quarkus/addons/process-definitions/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -0,0 +1,9 @@
+name: Kogito Add-On Process Defintions
+description: Kogito Process Definitions REST API
+metadata:
+ keywords:
+ - kogito
+ - process
+ - serverless workflow
+ categories:
+ - "business-automation"
diff --git a/quarkus/addons/process-definitions/runtime/src/test/java/org/kie/kogito/process/definitions/ProcessDefinitionsResourceTest.java b/quarkus/addons/process-definitions/runtime/src/test/java/org/kie/kogito/process/definitions/ProcessDefinitionsResourceTest.java
new file mode 100644
index 00000000000..746e435557a
--- /dev/null
+++ b/quarkus/addons/process-definitions/runtime/src/test/java/org/kie/kogito/process/definitions/ProcessDefinitionsResourceTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2020 Red Hat, Inc. and/or its affiliates.
+ *
+ * Licensed 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.definitions;
+
+import java.io.IOException;
+
+import org.junit.jupiter.api.Test;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.http.ContentType;
+
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.CoreMatchers.containsString;
+
+@QuarkusTest
+public class ProcessDefinitionsResourceTest {
+
+ @Test
+ void testAddDefinition() throws IOException {
+ given()
+ .contentType(ContentType.TEXT)
+ .accept(ContentType.TEXT)
+ .body(new String(Thread.currentThread().getContextClassLoader().getResource("helloworld.sw.json").openStream().readAllBytes())).when()
+ .post("/helloworld/definition")
+ .then()
+ .statusCode(200);
+
+ given()
+ .contentType(ContentType.JSON)
+ .accept(ContentType.JSON)
+ .when()
+ .post("/helloworld")
+ .then()
+ .statusCode(201)
+ .body("workflowdata.result", containsString("Hello World!"));
+ }
+}
diff --git a/quarkus/addons/process-definitions/runtime/src/test/resources/helloworld.sw.json b/quarkus/addons/process-definitions/runtime/src/test/resources/helloworld.sw.json
new file mode 100644
index 00000000000..8fa30d4fb72
--- /dev/null
+++ b/quarkus/addons/process-definitions/runtime/src/test/resources/helloworld.sw.json
@@ -0,0 +1,17 @@
+{
+"id": "helloworld",
+"version": "1.0",
+"name": "Hello World Workflow",
+"description": "Inject Hello World",
+"start": "Hello State",
+"states":[
+ {
+ "name":"Hello State",
+ "type":"inject",
+ "data": {
+ "result": "Hello World!"
+ },
+ "end": true
+ }
+]
+}
\ No newline at end of file
diff --git a/quarkus/addons/process-definitions/runtime/src/test/resources/logback-test.xml b/quarkus/addons/process-definitions/runtime/src/test/resources/logback-test.xml
new file mode 100755
index 00000000000..687a8d5976c
--- /dev/null
+++ b/quarkus/addons/process-definitions/runtime/src/test/resources/logback-test.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+ %d [%t|%C] %-5p %m%n
+
+
+
+
+
+
+
+
+
+
diff --git a/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow/pom.xml b/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow/pom.xml
index 879a3c63419..2f0c60b6878 100644
--- a/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow/pom.xml
+++ b/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow/pom.xml
@@ -26,10 +26,6 @@
io.quarkus
quarkus-cache
-
- org.kie.kogito
- kogito-serverless-workflow-executor-core
-
org.graalvm.nativeimage
svm