You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "fjtirado (via GitHub)" <gi...@apache.org> on 2024/03/14 16:51:55 UTC

[PR] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

fjtirado opened a new pull request, #585:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/585

   <!-- Please don't forget your Issue link -->
   Closes/Fixes/Resolves #ISSUE-NUMBER
   
   <!-- Please provide a short description of what this PR does -->
   **Description:**
   
   <!-- Link to related PRs: -->
   
   
   
   Please make sure that your PR meets the following requirements:
   
   - [ ] You have read the [contributions doc](https://github.com/apache/incubator-kie-kogito-docs/blob/main/CONTRIBUTING.md)
   - [ ] Pull Request title is properly formatted: `Issue-XYZ Subject`
   - [ ] Pull Request title contains the target branch if not targeting main: `[0.9.x] Issue-XYZ Subject`
   - [ ] The nav.adoc file has a link to this guide in the proper category
   - [ ] The index.adoc file has a card to this guide in the proper category, with a meaningful description
   
   <details>
   <summary>
   How to backport a pull request to a different branch?
   </summary>
   
   In order to automatically create a **backporting pull request** please add one or more labels having the following format `backport-<branch-name>`, where `<branch-name>` is the name of the branch where the pull request must be backported to (e.g., `backport-7.67.x` to backport the original PR to the `7.67.x` branch).
   
   > **NOTE**: **backporting** is an action aiming to move a change (usually a commit) from a branch (usually the main one) to another one, which is generally referring to a still maintained release branch. Keeping it simple: it is about to move a specific change or a set of them from one branch to another.
   
   Once the original pull request is successfully merged, the automated action will create one backporting pull request per each label (with the previous format) that has been added.
   
   If something goes wrong, the author will be notified and at this point a manual backporting is needed.
   
   > **NOTE**: this automated backporting is triggered whenever a pull request on `main` branch is labeled or closed, but both conditions must be satisfied to get the new PR created.
   </details>


-- 
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] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #585:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/585#issuecomment-1997962919

   🎊 PR Preview 49a9bc487032c649a7feb7400ac35ef237f5dc65 has been successfully built and deployed. See the documentation preview: https://sonataflow-docs-preview-pr-585.surge.sh
   <!-- Sticky Pull Request Comment -->
   <!-- Sticky Pull Request Comment -->


-- 
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] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

Posted by "kaldesai (via GitHub)" <gi...@apache.org>.
kaldesai commented on code in PR #585:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/585#discussion_r1529799709


##########
serverlessworkflow/modules/ROOT/pages/getting-started/java-embedded-workflows.adoc:
##########
@@ -0,0 +1,106 @@
+= Workflow embedded execution in Java 
+
+This guide show cases how to execute a link:{spec_doc_url}[CNCF Serverless Workflow] definition using a standard java virtual machine and a small set of Maven dependencies. Therefore, it is assumed you are fluent both in Java and Maven. 

Review Comment:
   ```suggestion
   This guide uses a standard Java virtual machine and a small set of Maven dependencies to execute a link:{spec_doc_url}[CNCF Serverless Workflow] definition. Therefore, it is assumed you are fluent both in Java and Maven. 
   ```



-- 
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] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

Posted by "kaldesai (via GitHub)" <gi...@apache.org>.
kaldesai commented on code in PR #585:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/585#discussion_r1529804546


##########
serverlessworkflow/modules/ROOT/pages/getting-started/java-embedded-workflows.adoc:
##########
@@ -0,0 +1,106 @@
+= Workflow embedded execution in Java 
+
+This guide show cases how to execute a link:{spec_doc_url}[CNCF Serverless Workflow] definition using a standard java virtual machine and a small set of Maven dependencies. Therefore, it is assumed you are fluent both in Java and Maven. 
+The workflow definition to be executed can be read from a .json or .yaml file or programatically defined using the {product_name} fluent API. 
+
+[[embedded-file-quick-start]]
+== Hello world (using existing definition file)
+
+First step is to setup an empty Maven project with the following dependency. 
+
+[source,xml]
+----
+<dependency>
+  <groupId>org.kie.kogito</groupId>
+  <artifactId>kogito-serverless-workflow-executor-core</artifactId>
+  <version>RELEASE</version>
+</dependency>
+----
+
+Also, you might optionally add `simple logger for java` dependency to avoid using `System.out.println`
+
+[source,xml]
+----
+ <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>1.7.36</version>
+  </dependency>
+----
+
+Let's assume you already have a workflow definition written in a JSON file in your project root. For example, link:{kogito_sw_examples_url}/serverless-workflow-hello-world/src/main/resources/hello.sw.json[Hello World] definition. To execute it, you need to write the following main java class (standard imports and java package declaration are intentionally skipped for brevity)
+
+[source,java]
+----
+import org.kie.kogito.serverless.workflow.executor.StaticWorkflowApplication;
+import org.kie.kogito.serverless.workflow.models.JsonNodeModel;
+import org.kie.kogito.serverless.workflow.utils.ServerlessWorkflowUtils;
+import org.kie.kogito.serverless.workflow.utils.WorkflowFormat;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.serverlessworkflow.api.Workflow;
+
+public class DefinitionFileExecutor {
+    private static final Logger logger = LoggerFactory.getLogger(DefinitionFileExecutor.class);
+
+    public static void main(String[] args) throws IOException {
+        try (Reader reader = new FileReader("hello.sw.json"); <1>
+                StaticWorkflowApplication application = StaticWorkflowApplication.create()) { <2>
+            Workflow workflow = ServerlessWorkflowUtils.getWorkflow(reader, WorkflowFormat.JSON); <3>
+            JsonNodeModel result = application.execute(workflow, Collections.emptyMap()); <4>
+            logger.info("Workflow execution result is {}", result.getWorkflowdata()); <5>
+        }
+    }
+}
+----
+<1> Reads the workflow file definition from the project root directory
+<2> Creates a static workflow application object. It is done within the try block since the instance is `Closeable`. This is the reference that allow you to execute workflow definitions.
+<3> Reads the Serverless Workflow Java SDK `Workflow` object from the file. 
+<4> Execute the workflow, passing `Workflow` reference and no parameters (an empty Map). The result of the workflow execution: process instance id and workflow output model, can accessed using `result` variable. 
+<5> Prints the workflow model in the configured standard output. 
+
+If you compile and execute this java class, you will see the following log in your configured standard output
+----
+Workflow execution result is {"greeting":"Hello World","mantra":"Serverless Workflow is awesome!"}
+----
+
+[[embedded-fluent-quick-start]]
+== Hello world (using fluent API)
+
+Using the same Maven setup than in the previous section, you can programatically generate that workflow definition rather than loading it from a file definition by using link:{kogito_runtimes_url}/kogito-serverless-workflow/kogito-serverless-workflow-fluent/src/main/java/org/kie/kogito/serverless/workflow/fluent[fluent API]
+
+Therefore, you can modify the previous example in a way that generates exactly the same output when it is executed, but rather creating a `FileReader` that reads the `Workflow` object, we create the `Workflow` object using java statements. The resulting modified main method is the following

Review Comment:
   ```suggestion
   Therefore, you can modify the previous example to generate the same output when it is executed, but rather than creating a `FileReader` that reads the `Workflow` object, we create the `Workflow` object using Java statements. The resulting modified main method is the following
   ```



-- 
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] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

Posted by "domhanak (via GitHub)" <gi...@apache.org>.
domhanak commented on code in PR #585:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/585#discussion_r1532044015


##########
serverlessworkflow/modules/ROOT/pages/getting-started/java-embedded-workflows.adoc:
##########
@@ -0,0 +1,106 @@
+= Workflow embedded execution in Java 
+
+This guide uses a standard Java virtual machine and a small set of Maven dependencies to execute a link:{spec_doc_url}[CNCF Serverless Workflow] definition. Therefore, it is assumed you are fluent both in Java and Maven. 
+The workflow definition to be executed can be read from a `.json` or `.yaml` file or programmatically defined using the {product_name} fluent API. 
+
+[[embedded-file-quick-start]]
+== Hello world (using existing definition file)
+
+The first step is to set up an empty Maven project with the following dependency:
+
+[source,xml]
+----
+<dependency>
+  <groupId>org.kie.kogito</groupId>
+  <artifactId>kogito-serverless-workflow-executor-core</artifactId>
+  <version>RELEASE</version>
+</dependency>
+----
+
+Also, you might optionally add a `simple logger for java` dependency to avoid using `System.out.println`
+
+[source,xml]
+----
+ <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>1.7.36</version>

Review Comment:
   This version would need updating, since it is an example I think referencing maven repo of slf4j is enough. Wdyt?



-- 
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] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

Posted by "fjtirado (via GitHub)" <gi...@apache.org>.
fjtirado commented on code in PR #585:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/585#discussion_r1525258978


##########
serverlessworkflow/modules/ROOT/pages/getting-started/java-embedded-workflows.adoc:
##########
@@ -0,0 +1,104 @@
+= Workflow embedded execution in Java 
+
+This guide show cases how to execute a link:{spec_doc_url}[CNCF Serverless Workflow] definition using a standard java virtual machine and a small set of Maven dependencies. Therefore, it is assumed you are fluent both in Java and Maven. 
+The workflow definition to be executed can be read from a .json or .yaml file or programatically defined using the {product_name} fluent API. 
+
+[[embedded-file-quick-start]]
+== Hello world (using existing definition file)
+
+First step is to setup an empty Maven project with the following dependency. 
+
+[source,xml]
+----
+<dependency>

Review Comment:
   @ricardozanini Yes, the renaming from kogito to sonataflow is far from completed 



-- 
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] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

Posted by "domhanak (via GitHub)" <gi...@apache.org>.
domhanak commented on code in PR #585:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/585#discussion_r1532042668


##########
serverlessworkflow/modules/ROOT/pages/getting-started/java-embedded-workflows.adoc:
##########
@@ -0,0 +1,106 @@
+= Workflow embedded execution in Java 
+
+This guide uses a standard Java virtual machine and a small set of Maven dependencies to execute a link:{spec_doc_url}[CNCF Serverless Workflow] definition. Therefore, it is assumed you are fluent both in Java and Maven. 
+The workflow definition to be executed can be read from a `.json` or `.yaml` file or programmatically defined using the {product_name} fluent API. 
+
+[[embedded-file-quick-start]]
+== Hello world (using existing definition file)
+
+The first step is to set up an empty Maven project with the following dependency:
+
+[source,xml]
+----
+<dependency>
+  <groupId>org.kie.kogito</groupId>
+  <artifactId>kogito-serverless-workflow-executor-core</artifactId>
+  <version>RELEASE</version>

Review Comment:
   suggestion 1:  we could reference maven repository of this dependency  for better UX.
   
   suggestion 2: use some variable from `antora.yaml` which is unified across the docs, `sonataflow_kie_apache_version=999.0.0-SNAPSHOT` ( for releases, we fix it to 10.0.0.Final ). Unfication can be done later.



-- 
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] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

Posted by "kaldesai (via GitHub)" <gi...@apache.org>.
kaldesai commented on code in PR #585:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/585#discussion_r1529803438


##########
serverlessworkflow/modules/ROOT/pages/getting-started/java-embedded-workflows.adoc:
##########
@@ -0,0 +1,106 @@
+= Workflow embedded execution in Java 
+
+This guide show cases how to execute a link:{spec_doc_url}[CNCF Serverless Workflow] definition using a standard java virtual machine and a small set of Maven dependencies. Therefore, it is assumed you are fluent both in Java and Maven. 
+The workflow definition to be executed can be read from a .json or .yaml file or programatically defined using the {product_name} fluent API. 
+
+[[embedded-file-quick-start]]
+== Hello world (using existing definition file)
+
+First step is to setup an empty Maven project with the following dependency. 
+
+[source,xml]
+----
+<dependency>
+  <groupId>org.kie.kogito</groupId>
+  <artifactId>kogito-serverless-workflow-executor-core</artifactId>
+  <version>RELEASE</version>
+</dependency>
+----
+
+Also, you might optionally add `simple logger for java` dependency to avoid using `System.out.println`
+
+[source,xml]
+----
+ <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>1.7.36</version>
+  </dependency>
+----
+
+Let's assume you already have a workflow definition written in a JSON file in your project root. For example, link:{kogito_sw_examples_url}/serverless-workflow-hello-world/src/main/resources/hello.sw.json[Hello World] definition. To execute it, you need to write the following main java class (standard imports and java package declaration are intentionally skipped for brevity)
+
+[source,java]
+----
+import org.kie.kogito.serverless.workflow.executor.StaticWorkflowApplication;
+import org.kie.kogito.serverless.workflow.models.JsonNodeModel;
+import org.kie.kogito.serverless.workflow.utils.ServerlessWorkflowUtils;
+import org.kie.kogito.serverless.workflow.utils.WorkflowFormat;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.serverlessworkflow.api.Workflow;
+
+public class DefinitionFileExecutor {
+    private static final Logger logger = LoggerFactory.getLogger(DefinitionFileExecutor.class);
+
+    public static void main(String[] args) throws IOException {
+        try (Reader reader = new FileReader("hello.sw.json"); <1>
+                StaticWorkflowApplication application = StaticWorkflowApplication.create()) { <2>
+            Workflow workflow = ServerlessWorkflowUtils.getWorkflow(reader, WorkflowFormat.JSON); <3>
+            JsonNodeModel result = application.execute(workflow, Collections.emptyMap()); <4>
+            logger.info("Workflow execution result is {}", result.getWorkflowdata()); <5>
+        }
+    }
+}
+----
+<1> Reads the workflow file definition from the project root directory
+<2> Creates a static workflow application object. It is done within the try block since the instance is `Closeable`. This is the reference that allow you to execute workflow definitions.
+<3> Reads the Serverless Workflow Java SDK `Workflow` object from the file. 
+<4> Execute the workflow, passing `Workflow` reference and no parameters (an empty Map). The result of the workflow execution: process instance id and workflow output model, can accessed using `result` variable. 
+<5> Prints the workflow model in the configured standard output. 
+
+If you compile and execute this java class, you will see the following log in your configured standard output

Review Comment:
   ```suggestion
   If you compile and execute this Java class, you will see the following log in your configured standard output:
   ```



-- 
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] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

Posted by "kaldesai (via GitHub)" <gi...@apache.org>.
kaldesai commented on code in PR #585:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/585#discussion_r1529803040


##########
serverlessworkflow/modules/ROOT/pages/getting-started/java-embedded-workflows.adoc:
##########
@@ -0,0 +1,106 @@
+= Workflow embedded execution in Java 
+
+This guide show cases how to execute a link:{spec_doc_url}[CNCF Serverless Workflow] definition using a standard java virtual machine and a small set of Maven dependencies. Therefore, it is assumed you are fluent both in Java and Maven. 
+The workflow definition to be executed can be read from a .json or .yaml file or programatically defined using the {product_name} fluent API. 
+
+[[embedded-file-quick-start]]
+== Hello world (using existing definition file)
+
+First step is to setup an empty Maven project with the following dependency. 
+
+[source,xml]
+----
+<dependency>
+  <groupId>org.kie.kogito</groupId>
+  <artifactId>kogito-serverless-workflow-executor-core</artifactId>
+  <version>RELEASE</version>
+</dependency>
+----
+
+Also, you might optionally add `simple logger for java` dependency to avoid using `System.out.println`
+
+[source,xml]
+----
+ <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>1.7.36</version>
+  </dependency>
+----
+
+Let's assume you already have a workflow definition written in a JSON file in your project root. For example, link:{kogito_sw_examples_url}/serverless-workflow-hello-world/src/main/resources/hello.sw.json[Hello World] definition. To execute it, you need to write the following main java class (standard imports and java package declaration are intentionally skipped for brevity)

Review Comment:
   ```suggestion
   Let's assume you already have a workflow definition written in a JSON file in your root project. For example, link:{kogito_sw_examples_url}/serverless-workflow-hello-world/src/main/resources/hello.sw.json[Hello World] definition. To execute it, you must write the following main Java class (standard imports and Java package declaration are intentionally skipped for briefness)
   ```



-- 
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] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

Posted by "ricardozanini (via GitHub)" <gi...@apache.org>.
ricardozanini commented on code in PR #585:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/585#discussion_r1525299786


##########
serverlessworkflow/modules/ROOT/pages/getting-started/java-embedded-workflows.adoc:
##########
@@ -0,0 +1,104 @@
+= Workflow embedded execution in Java 
+
+This guide show cases how to execute a link:{spec_doc_url}[CNCF Serverless Workflow] definition using a standard java virtual machine and a small set of Maven dependencies. Therefore, it is assumed you are fluent both in Java and Maven. 
+The workflow definition to be executed can be read from a .json or .yaml file or programatically defined using the {product_name} fluent API. 
+
+[[embedded-file-quick-start]]
+== Hello world (using existing definition file)
+
+First step is to setup an empty Maven project with the following dependency. 
+
+[source,xml]
+----
+<dependency>
+  <groupId>org.kie.kogito</groupId>
+  <artifactId>kogito-serverless-workflow-executor-core</artifactId>
+  <version>RELEASE</version>
+</dependency>
+----
+
+Also, you might optionally add `simple logger for java` dependency to avoid using `system.out.println`
+
+[source,xml]
+----
+ <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>1.7.36</version>
+  </dependency>
+----
+
+Lets assume you already have a workflow definition written in a JSON file in your project root. For example, link:{kogito_sw_examples_url}/serverless-workflow-hello-world/src/main/resources/hello.sw.json[Hello World] definition. In order to execute it, you need to write the following main java class (standard imports and java package declaration are intentionally skipped for brevity)
+
+[source,java]
+----
+import org.kie.kogito.serverless.workflow.executor.StaticWorkflowApplication;
+import org.kie.kogito.serverless.workflow.models.JsonNodeModel;
+import org.kie.kogito.serverless.workflow.utils.ServerlessWorkflowUtils;
+import org.kie.kogito.serverless.workflow.utils.WorkflowFormat;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.serverlessworkflow.api.Workflow;
+
+public class DefinitionFileExecutor {
+    private static final Logger logger = LoggerFactory.getLogger(DefinitionFileExecutor.class);
+
+    public static void main(String[] args) throws IOException {
+        try (Reader reader = new FileReader("hello.sw.json"); <1>
+                StaticWorkflowApplication application = StaticWorkflowApplication.create()) { <2>
+            Workflow workflow = ServerlessWorkflowUtils.getWorkflow(reader, WorkflowFormat.JSON); <3>
+            JsonNodeModel result = application.execute(workflow, Collections.emptyMap()); <4>
+            logger.info("Workflow execution result is {}", result.getWorkflowdata()); <5>
+        }
+    }
+}
+----
+<1> Reads the workflow file definition from the project root directory
+<2> Creates a static workflow application object. It is done within the try block since the instance is `Closeable`. This is the reference that allow you to execute workflow definitions.
+<3> Reads the Serverless Workflow Java SDK `Workflow` object from the file. 
+<4> Execute the workflow, passing `Workflow` reference and no parameters (an empty Map). The result of the workflow execution: process instance id and workflow output model, can accessed using `result` variable. 
+<5> Prints the workflow model in the configured standard output. 
+
+If you compile and execute this java class, you will see the following log in your configured standard output
+----
+Workflow execution result is {"greeting":"Hello World","mantra":"Serverless Workflow is awesome!"}
+----
+
+[[embedded-fluent-quick-start]]
+== Hello world (using fluent API)
+
+Using the same Maven setup than in the previous section, you can programatically generate that workflow definition rather than loading it from a file definition by using link:{kogito_runtimes_url}/kogito-serverless-workflow/kogito-serverless-workflow-fluent/src/main/java/org/kie/kogito/serverless/workflow/fluent[fluent API]
+
+Therefore, you can modify the previous example in a way that generates exactly the same output when it is executed, but rather creating a `FileReader` that reads the `Workflow` object, we create the `Workflow` object using java statements. The resulting modified main method is the following
+
+[source,java]
+----
+      try (StaticWorkflowApplication application = StaticWorkflowApplication.create()) {
+            Workflow workflow = workflow("HelloWorld"). <1>
+            		start( <2>
+            				inject( <3>
+            						jsonObject().put("greeting", "Hello World").put("mantra","Serverless Workflow is awesome!"))) <4>
+            		.end() <5>
+            		.build(); <6>
+            logger.info("Workflow execution result is {}",application.execute(workflow, Collections.emptyMap()).getWorkflowdata());  <7>
+        }
+----
+<1> Creates a workflow which name is `HelloWorld`
+<2> Indicate that you are going to specify the start state
+<3> A Inject state is the start state
+<4> Inject state accepts static json, therefore this line creates the JSON data
+<5> End the workflow definition 
+<6> Build the workflow definition
+<7> Execute and print as in previous example
+
+
+== Additional resources
+
+You can find additional and commented examples of fluent API usage (including jq expression evaluation and orchestation of rest services) link:https://github.com/fjtirado/java-flow/tree/main/java-flow-example/src/main/java/org/kie/kogito/serverless/workflow/examples[here]

Review Comment:
   Either examples and docs can be outdated. But I guess having examples in our CI, makes them easier to spot and then update.



-- 
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] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

Posted by "kaldesai (via GitHub)" <gi...@apache.org>.
kaldesai commented on code in PR #585:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/585#discussion_r1529801505


##########
serverlessworkflow/modules/ROOT/pages/getting-started/java-embedded-workflows.adoc:
##########
@@ -0,0 +1,106 @@
+= Workflow embedded execution in Java 
+
+This guide show cases how to execute a link:{spec_doc_url}[CNCF Serverless Workflow] definition using a standard java virtual machine and a small set of Maven dependencies. Therefore, it is assumed you are fluent both in Java and Maven. 
+The workflow definition to be executed can be read from a .json or .yaml file or programatically defined using the {product_name} fluent API. 
+
+[[embedded-file-quick-start]]
+== Hello world (using existing definition file)
+
+First step is to setup an empty Maven project with the following dependency. 
+
+[source,xml]
+----
+<dependency>
+  <groupId>org.kie.kogito</groupId>
+  <artifactId>kogito-serverless-workflow-executor-core</artifactId>
+  <version>RELEASE</version>
+</dependency>
+----
+
+Also, you might optionally add `simple logger for java` dependency to avoid using `System.out.println`

Review Comment:
   ```suggestion
   Also, you might optionally add a `simple logger for java` dependency to avoid using `System.out.println`
   ```



-- 
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] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

Posted by "domhanak (via GitHub)" <gi...@apache.org>.
domhanak commented on code in PR #585:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/585#discussion_r1532052324


##########
serverlessworkflow/modules/ROOT/pages/getting-started/java-embedded-workflows.adoc:
##########
@@ -0,0 +1,106 @@
+= Workflow embedded execution in Java 
+
+This guide uses a standard Java virtual machine and a small set of Maven dependencies to execute a link:{spec_doc_url}[CNCF Serverless Workflow] definition. Therefore, it is assumed you are fluent both in Java and Maven. 
+The workflow definition to be executed can be read from a `.json` or `.yaml` file or programmatically defined using the {product_name} fluent API. 
+

Review Comment:
   ```suggestion
   .Prerequisites
   . Install https://openjdk.org/[OpenJDK] {java_min_version} 
   . Install https://maven.apache.org/index.html[Apache Maven] {maven_min_version}.
   
   ```



-- 
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] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

Posted by "fjtirado (via GitHub)" <gi...@apache.org>.
fjtirado commented on code in PR #585:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/585#discussion_r1525258978


##########
serverlessworkflow/modules/ROOT/pages/getting-started/java-embedded-workflows.adoc:
##########
@@ -0,0 +1,104 @@
+= Workflow embedded execution in Java 
+
+This guide show cases how to execute a link:{spec_doc_url}[CNCF Serverless Workflow] definition using a standard java virtual machine and a small set of Maven dependencies. Therefore, it is assumed you are fluent both in Java and Maven. 
+The workflow definition to be executed can be read from a .json or .yaml file or programatically defined using the {product_name} fluent API. 
+
+[[embedded-file-quick-start]]
+== Hello world (using existing definition file)
+
+First step is to setup an empty Maven project with the following dependency. 
+
+[source,xml]
+----
+<dependency>

Review Comment:
   @ricardozanini the renaming from kogito to sonataflow is far from completed. I check latest and no dependency has been changed under kogito-serverless-workflow, only quarkus addons and extensions. 



-- 
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] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

Posted by "fjtirado (via GitHub)" <gi...@apache.org>.
fjtirado commented on code in PR #585:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/585#discussion_r1531855632


##########
serverlessworkflow/modules/ROOT/pages/getting-started/java-embedded-workflows.adoc:
##########
@@ -0,0 +1,104 @@
+= Workflow embedded execution in Java 
+
+This guide show cases how to execute a link:{spec_doc_url}[CNCF Serverless Workflow] definition using a standard java virtual machine and a small set of Maven dependencies. Therefore, it is assumed you are fluent both in Java and Maven. 
+The workflow definition to be executed can be read from a .json or .yaml file or programatically defined using the {product_name} fluent API. 
+
+[[embedded-file-quick-start]]
+== Hello world (using existing definition file)
+
+First step is to setup an empty Maven project with the following dependency. 
+
+[source,xml]
+----
+<dependency>

Review Comment:
   The rename will be done with https://github.com/apache/incubator-kie-kogito-runtimes/issues/3447



-- 
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] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

Posted by "kaldesai (via GitHub)" <gi...@apache.org>.
kaldesai commented on code in PR #585:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/585#discussion_r1529800317


##########
serverlessworkflow/modules/ROOT/pages/getting-started/java-embedded-workflows.adoc:
##########
@@ -0,0 +1,106 @@
+= Workflow embedded execution in Java 
+
+This guide show cases how to execute a link:{spec_doc_url}[CNCF Serverless Workflow] definition using a standard java virtual machine and a small set of Maven dependencies. Therefore, it is assumed you are fluent both in Java and Maven. 
+The workflow definition to be executed can be read from a .json or .yaml file or programatically defined using the {product_name} fluent API. 

Review Comment:
   ```suggestion
   The workflow definition to be executed can be read from a `.json` or `.yaml` file or programmatically defined using the {product_name} fluent API. 
   ```



-- 
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] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

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


-- 
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] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

Posted by "kaldesai (via GitHub)" <gi...@apache.org>.
kaldesai commented on code in PR #585:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/585#discussion_r1529805400


##########
serverlessworkflow/modules/ROOT/pages/getting-started/java-embedded-workflows.adoc:
##########
@@ -0,0 +1,106 @@
+= Workflow embedded execution in Java 
+
+This guide show cases how to execute a link:{spec_doc_url}[CNCF Serverless Workflow] definition using a standard java virtual machine and a small set of Maven dependencies. Therefore, it is assumed you are fluent both in Java and Maven. 
+The workflow definition to be executed can be read from a .json or .yaml file or programatically defined using the {product_name} fluent API. 
+
+[[embedded-file-quick-start]]
+== Hello world (using existing definition file)
+
+First step is to setup an empty Maven project with the following dependency. 
+
+[source,xml]
+----
+<dependency>
+  <groupId>org.kie.kogito</groupId>
+  <artifactId>kogito-serverless-workflow-executor-core</artifactId>
+  <version>RELEASE</version>
+</dependency>
+----
+
+Also, you might optionally add `simple logger for java` dependency to avoid using `System.out.println`
+
+[source,xml]
+----
+ <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>1.7.36</version>
+  </dependency>
+----
+
+Let's assume you already have a workflow definition written in a JSON file in your project root. For example, link:{kogito_sw_examples_url}/serverless-workflow-hello-world/src/main/resources/hello.sw.json[Hello World] definition. To execute it, you need to write the following main java class (standard imports and java package declaration are intentionally skipped for brevity)
+
+[source,java]
+----
+import org.kie.kogito.serverless.workflow.executor.StaticWorkflowApplication;
+import org.kie.kogito.serverless.workflow.models.JsonNodeModel;
+import org.kie.kogito.serverless.workflow.utils.ServerlessWorkflowUtils;
+import org.kie.kogito.serverless.workflow.utils.WorkflowFormat;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.serverlessworkflow.api.Workflow;
+
+public class DefinitionFileExecutor {
+    private static final Logger logger = LoggerFactory.getLogger(DefinitionFileExecutor.class);
+
+    public static void main(String[] args) throws IOException {
+        try (Reader reader = new FileReader("hello.sw.json"); <1>
+                StaticWorkflowApplication application = StaticWorkflowApplication.create()) { <2>
+            Workflow workflow = ServerlessWorkflowUtils.getWorkflow(reader, WorkflowFormat.JSON); <3>
+            JsonNodeModel result = application.execute(workflow, Collections.emptyMap()); <4>
+            logger.info("Workflow execution result is {}", result.getWorkflowdata()); <5>
+        }
+    }
+}
+----
+<1> Reads the workflow file definition from the project root directory
+<2> Creates a static workflow application object. It is done within the try block since the instance is `Closeable`. This is the reference that allow you to execute workflow definitions.
+<3> Reads the Serverless Workflow Java SDK `Workflow` object from the file. 
+<4> Execute the workflow, passing `Workflow` reference and no parameters (an empty Map). The result of the workflow execution: process instance id and workflow output model, can accessed using `result` variable. 
+<5> Prints the workflow model in the configured standard output. 
+
+If you compile and execute this java class, you will see the following log in your configured standard output
+----
+Workflow execution result is {"greeting":"Hello World","mantra":"Serverless Workflow is awesome!"}
+----
+
+[[embedded-fluent-quick-start]]
+== Hello world (using fluent API)
+
+Using the same Maven setup than in the previous section, you can programatically generate that workflow definition rather than loading it from a file definition by using link:{kogito_runtimes_url}/kogito-serverless-workflow/kogito-serverless-workflow-fluent/src/main/java/org/kie/kogito/serverless/workflow/fluent[fluent API]

Review Comment:
   ```suggestion
   Using the same Maven setup as in the previous section, you can programmatically generate that workflow definition rather than loading it from a file definition by using the link:{kogito_runtimes_url}/kogito-serverless-workflow/kogito-serverless-workflow-fluent/src/main/java/org/kie/kogito/serverless/workflow/fluent[fluent API]
   ```



-- 
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] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

Posted by "kaldesai (via GitHub)" <gi...@apache.org>.
kaldesai commented on code in PR #585:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/585#discussion_r1529800827


##########
serverlessworkflow/modules/ROOT/pages/getting-started/java-embedded-workflows.adoc:
##########
@@ -0,0 +1,106 @@
+= Workflow embedded execution in Java 
+
+This guide show cases how to execute a link:{spec_doc_url}[CNCF Serverless Workflow] definition using a standard java virtual machine and a small set of Maven dependencies. Therefore, it is assumed you are fluent both in Java and Maven. 
+The workflow definition to be executed can be read from a .json or .yaml file or programatically defined using the {product_name} fluent API. 
+
+[[embedded-file-quick-start]]
+== Hello world (using existing definition file)
+
+First step is to setup an empty Maven project with the following dependency. 

Review Comment:
   ```suggestion
   The first step is to set up an empty Maven project with the following dependency:
   ```



-- 
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] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

Posted by "domhanak (via GitHub)" <gi...@apache.org>.
domhanak commented on code in PR #585:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/585#discussion_r1532049064


##########
serverlessworkflow/modules/ROOT/pages/getting-started/java-embedded-workflows.adoc:
##########
@@ -0,0 +1,106 @@
+= Workflow embedded execution in Java 
+
+This guide uses a standard Java virtual machine and a small set of Maven dependencies to execute a link:{spec_doc_url}[CNCF Serverless Workflow] definition. Therefore, it is assumed you are fluent both in Java and Maven. 
+The workflow definition to be executed can be read from a `.json` or `.yaml` file or programmatically defined using the {product_name} fluent API. 
+
+[[embedded-file-quick-start]]
+== Hello world (using existing definition file)
+
+The first step is to set up an empty Maven project with the following dependency:
+
+[source,xml]
+----
+<dependency>
+  <groupId>org.kie.kogito</groupId>
+  <artifactId>kogito-serverless-workflow-executor-core</artifactId>
+  <version>RELEASE</version>
+</dependency>
+----
+
+Also, you might optionally add a `simple logger for java` dependency to avoid using `System.out.println`

Review Comment:
   ```suggestion
   This guide uses [slf4j dependency](https://mvnrepository.com/artifact/org.slf4j/slf4j-simple). Consider using any other logger for java to avoid using `System.out.println`
   ```



-- 
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] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

Posted by "fjtirado (via GitHub)" <gi...@apache.org>.
fjtirado commented on code in PR #585:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/585#discussion_r1525258978


##########
serverlessworkflow/modules/ROOT/pages/getting-started/java-embedded-workflows.adoc:
##########
@@ -0,0 +1,104 @@
+= Workflow embedded execution in Java 
+
+This guide show cases how to execute a link:{spec_doc_url}[CNCF Serverless Workflow] definition using a standard java virtual machine and a small set of Maven dependencies. Therefore, it is assumed you are fluent both in Java and Maven. 
+The workflow definition to be executed can be read from a .json or .yaml file or programatically defined using the {product_name} fluent API. 
+
+[[embedded-file-quick-start]]
+== Hello world (using existing definition file)
+
+First step is to setup an empty Maven project with the following dependency. 
+
+[source,xml]
+----
+<dependency>

Review Comment:
   @ricardozanini Yes, the renaming from kogito to sonataflow is far from completed. I check latest and no dependency has been changed under kogito-serverless-workflow, only quarkus addons and extensions. 



-- 
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] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

Posted by "ricardozanini (via GitHub)" <gi...@apache.org>.
ricardozanini commented on PR #585:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/585#issuecomment-2004012566

   @kaldesai can you ptal?


-- 
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] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

Posted by "gmunozfe (via GitHub)" <gi...@apache.org>.
gmunozfe commented on code in PR #585:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/585#discussion_r1528048528


##########
serverlessworkflow/modules/ROOT/pages/getting-started/java-embedded-workflows.adoc:
##########
@@ -0,0 +1,104 @@
+= Workflow embedded execution in Java 
+
+This guide show cases how to execute a link:{spec_doc_url}[CNCF Serverless Workflow] definition using a standard java virtual machine and a small set of Maven dependencies. Therefore, it is assumed you are fluent both in Java and Maven. 
+The workflow definition to be executed can be read from a .json or .yaml file or programatically defined using the {product_name} fluent API. 
+
+[[embedded-file-quick-start]]
+== Hello world (using existing definition file)
+
+First step is to setup an empty Maven project with the following dependency. 
+
+[source,xml]
+----
+<dependency>
+  <groupId>org.kie.kogito</groupId>
+  <artifactId>kogito-serverless-workflow-executor-core</artifactId>
+  <version>RELEASE</version>
+</dependency>
+----
+
+Also, you might optionally add `simple logger for java` dependency to avoid using `system.out.println`

Review Comment:
   ```suggestion
   Also, you might optionally add `simple logger for java` dependency to avoid using `System.out.println`
   ```



##########
serverlessworkflow/modules/ROOT/pages/getting-started/java-embedded-workflows.adoc:
##########
@@ -0,0 +1,104 @@
+= Workflow embedded execution in Java 
+
+This guide show cases how to execute a link:{spec_doc_url}[CNCF Serverless Workflow] definition using a standard java virtual machine and a small set of Maven dependencies. Therefore, it is assumed you are fluent both in Java and Maven. 
+The workflow definition to be executed can be read from a .json or .yaml file or programatically defined using the {product_name} fluent API. 
+
+[[embedded-file-quick-start]]
+== Hello world (using existing definition file)
+
+First step is to setup an empty Maven project with the following dependency. 
+
+[source,xml]
+----
+<dependency>
+  <groupId>org.kie.kogito</groupId>
+  <artifactId>kogito-serverless-workflow-executor-core</artifactId>
+  <version>RELEASE</version>
+</dependency>
+----
+
+Also, you might optionally add `simple logger for java` dependency to avoid using `system.out.println`
+
+[source,xml]
+----
+ <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>1.7.36</version>
+  </dependency>
+----
+
+Lets assume you already have a workflow definition written in a JSON file in your project root. For example, link:{kogito_sw_examples_url}/serverless-workflow-hello-world/src/main/resources/hello.sw.json[Hello World] definition. In order to execute it, you need to write the following main java class (standard imports and java package declaration are intentionally skipped for brevity)

Review Comment:
   ```suggestion
   Let's assume you already have a workflow definition written in a JSON file in your project root. For example, link:{kogito_sw_examples_url}/serverless-workflow-hello-world/src/main/resources/hello.sw.json[Hello World] definition. To execute it, you need to write the following main java class (standard imports and java package declaration are intentionally skipped for brevity)
   ```



-- 
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] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

Posted by "fjtirado (via GitHub)" <gi...@apache.org>.
fjtirado commented on code in PR #585:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/585#discussion_r1525261321


##########
serverlessworkflow/modules/ROOT/pages/getting-started/java-embedded-workflows.adoc:
##########
@@ -0,0 +1,104 @@
+= Workflow embedded execution in Java 
+
+This guide show cases how to execute a link:{spec_doc_url}[CNCF Serverless Workflow] definition using a standard java virtual machine and a small set of Maven dependencies. Therefore, it is assumed you are fluent both in Java and Maven. 
+The workflow definition to be executed can be read from a .json or .yaml file or programatically defined using the {product_name} fluent API. 
+
+[[embedded-file-quick-start]]
+== Hello world (using existing definition file)
+
+First step is to setup an empty Maven project with the following dependency. 
+
+[source,xml]
+----
+<dependency>
+  <groupId>org.kie.kogito</groupId>
+  <artifactId>kogito-serverless-workflow-executor-core</artifactId>
+  <version>RELEASE</version>
+</dependency>
+----
+
+Also, you might optionally add `simple logger for java` dependency to avoid using `system.out.println`
+
+[source,xml]
+----
+ <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>1.7.36</version>
+  </dependency>
+----
+
+Lets assume you already have a workflow definition written in a JSON file in your project root. For example, link:{kogito_sw_examples_url}/serverless-workflow-hello-world/src/main/resources/hello.sw.json[Hello World] definition. In order to execute it, you need to write the following main java class (standard imports and java package declaration are intentionally skipped for brevity)
+
+[source,java]
+----
+import org.kie.kogito.serverless.workflow.executor.StaticWorkflowApplication;
+import org.kie.kogito.serverless.workflow.models.JsonNodeModel;
+import org.kie.kogito.serverless.workflow.utils.ServerlessWorkflowUtils;
+import org.kie.kogito.serverless.workflow.utils.WorkflowFormat;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.serverlessworkflow.api.Workflow;
+
+public class DefinitionFileExecutor {
+    private static final Logger logger = LoggerFactory.getLogger(DefinitionFileExecutor.class);
+
+    public static void main(String[] args) throws IOException {
+        try (Reader reader = new FileReader("hello.sw.json"); <1>
+                StaticWorkflowApplication application = StaticWorkflowApplication.create()) { <2>
+            Workflow workflow = ServerlessWorkflowUtils.getWorkflow(reader, WorkflowFormat.JSON); <3>
+            JsonNodeModel result = application.execute(workflow, Collections.emptyMap()); <4>
+            logger.info("Workflow execution result is {}", result.getWorkflowdata()); <5>
+        }
+    }
+}
+----
+<1> Reads the workflow file definition from the project root directory
+<2> Creates a static workflow application object. It is done within the try block since the instance is `Closeable`. This is the reference that allow you to execute workflow definitions.
+<3> Reads the Serverless Workflow Java SDK `Workflow` object from the file. 
+<4> Execute the workflow, passing `Workflow` reference and no parameters (an empty Map). The result of the workflow execution: process instance id and workflow output model, can accessed using `result` variable. 
+<5> Prints the workflow model in the configured standard output. 
+
+If you compile and execute this java class, you will see the following log in your configured standard output
+----
+Workflow execution result is {"greeting":"Hello World","mantra":"Serverless Workflow is awesome!"}
+----
+
+[[embedded-fluent-quick-start]]
+== Hello world (using fluent API)
+
+Using the same Maven setup than in the previous section, you can programatically generate that workflow definition rather than loading it from a file definition by using link:{kogito_runtimes_url}/kogito-serverless-workflow/kogito-serverless-workflow-fluent/src/main/java/org/kie/kogito/serverless/workflow/fluent[fluent API]
+
+Therefore, you can modify the previous example in a way that generates exactly the same output when it is executed, but rather creating a `FileReader` that reads the `Workflow` object, we create the `Workflow` object using java statements. The resulting modified main method is the following
+
+[source,java]
+----
+      try (StaticWorkflowApplication application = StaticWorkflowApplication.create()) {
+            Workflow workflow = workflow("HelloWorld"). <1>
+            		start( <2>
+            				inject( <3>
+            						jsonObject().put("greeting", "Hello World").put("mantra","Serverless Workflow is awesome!"))) <4>
+            		.end() <5>
+            		.build(); <6>
+            logger.info("Workflow execution result is {}",application.execute(workflow, Collections.emptyMap()).getWorkflowdata());  <7>
+        }
+----
+<1> Creates a workflow which name is `HelloWorld`
+<2> Indicate that you are going to specify the start state
+<3> A Inject state is the start state
+<4> Inject state accepts static json, therefore this line creates the JSON data
+<5> End the workflow definition 
+<6> Build the workflow definition
+<7> Execute and print as in previous example
+
+
+== Additional resources
+
+You can find additional and commented examples of fluent API usage (including jq expression evaluation and orchestation of rest services) link:https://github.com/fjtirado/java-flow/tree/main/java-flow-example/src/main/java/org/kie/kogito/serverless/workflow/examples[here]

Review Comment:
   Wondering if we should keep this guide small and refer to further, already written examples or we prefer the "verbose" approach, with the risk of outdating



-- 
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] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

Posted by "fjtirado (via GitHub)" <gi...@apache.org>.
fjtirado commented on code in PR #585:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/585#discussion_r1525379517


##########
serverlessworkflow/modules/ROOT/pages/getting-started/java-embedded-workflows.adoc:
##########
@@ -0,0 +1,104 @@
+= Workflow embedded execution in Java 
+
+This guide show cases how to execute a link:{spec_doc_url}[CNCF Serverless Workflow] definition using a standard java virtual machine and a small set of Maven dependencies. Therefore, it is assumed you are fluent both in Java and Maven. 
+The workflow definition to be executed can be read from a .json or .yaml file or programatically defined using the {product_name} fluent API. 
+
+[[embedded-file-quick-start]]
+== Hello world (using existing definition file)
+
+First step is to setup an empty Maven project with the following dependency. 
+
+[source,xml]
+----
+<dependency>
+  <groupId>org.kie.kogito</groupId>
+  <artifactId>kogito-serverless-workflow-executor-core</artifactId>
+  <version>RELEASE</version>
+</dependency>
+----
+
+Also, you might optionally add `simple logger for java` dependency to avoid using `system.out.println`
+
+[source,xml]
+----
+ <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>1.7.36</version>
+  </dependency>
+----
+
+Lets assume you already have a workflow definition written in a JSON file in your project root. For example, link:{kogito_sw_examples_url}/serverless-workflow-hello-world/src/main/resources/hello.sw.json[Hello World] definition. In order to execute it, you need to write the following main java class (standard imports and java package declaration are intentionally skipped for brevity)
+
+[source,java]
+----
+import org.kie.kogito.serverless.workflow.executor.StaticWorkflowApplication;
+import org.kie.kogito.serverless.workflow.models.JsonNodeModel;
+import org.kie.kogito.serverless.workflow.utils.ServerlessWorkflowUtils;
+import org.kie.kogito.serverless.workflow.utils.WorkflowFormat;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.serverlessworkflow.api.Workflow;
+
+public class DefinitionFileExecutor {
+    private static final Logger logger = LoggerFactory.getLogger(DefinitionFileExecutor.class);
+
+    public static void main(String[] args) throws IOException {
+        try (Reader reader = new FileReader("hello.sw.json"); <1>
+                StaticWorkflowApplication application = StaticWorkflowApplication.create()) { <2>
+            Workflow workflow = ServerlessWorkflowUtils.getWorkflow(reader, WorkflowFormat.JSON); <3>
+            JsonNodeModel result = application.execute(workflow, Collections.emptyMap()); <4>
+            logger.info("Workflow execution result is {}", result.getWorkflowdata()); <5>
+        }
+    }
+}
+----
+<1> Reads the workflow file definition from the project root directory
+<2> Creates a static workflow application object. It is done within the try block since the instance is `Closeable`. This is the reference that allow you to execute workflow definitions.
+<3> Reads the Serverless Workflow Java SDK `Workflow` object from the file. 
+<4> Execute the workflow, passing `Workflow` reference and no parameters (an empty Map). The result of the workflow execution: process instance id and workflow output model, can accessed using `result` variable. 
+<5> Prints the workflow model in the configured standard output. 
+
+If you compile and execute this java class, you will see the following log in your configured standard output
+----
+Workflow execution result is {"greeting":"Hello World","mantra":"Serverless Workflow is awesome!"}
+----
+
+[[embedded-fluent-quick-start]]
+== Hello world (using fluent API)
+
+Using the same Maven setup than in the previous section, you can programatically generate that workflow definition rather than loading it from a file definition by using link:{kogito_runtimes_url}/kogito-serverless-workflow/kogito-serverless-workflow-fluent/src/main/java/org/kie/kogito/serverless/workflow/fluent[fluent API]
+
+Therefore, you can modify the previous example in a way that generates exactly the same output when it is executed, but rather creating a `FileReader` that reads the `Workflow` object, we create the `Workflow` object using java statements. The resulting modified main method is the following
+
+[source,java]
+----
+      try (StaticWorkflowApplication application = StaticWorkflowApplication.create()) {
+            Workflow workflow = workflow("HelloWorld"). <1>
+            		start( <2>
+            				inject( <3>
+            						jsonObject().put("greeting", "Hello World").put("mantra","Serverless Workflow is awesome!"))) <4>
+            		.end() <5>
+            		.build(); <6>
+            logger.info("Workflow execution result is {}",application.execute(workflow, Collections.emptyMap()).getWorkflowdata());  <7>
+        }
+----
+<1> Creates a workflow which name is `HelloWorld`
+<2> Indicate that you are going to specify the start state
+<3> A Inject state is the start state
+<4> Inject state accepts static json, therefore this line creates the JSON data
+<5> End the workflow definition 
+<6> Build the workflow definition
+<7> Execute and print as in previous example
+
+
+== Additional resources
+
+You can find additional and commented examples of fluent API usage (including jq expression evaluation and orchestation of rest services) link:https://github.com/fjtirado/java-flow/tree/main/java-flow-example/src/main/java/org/kie/kogito/serverless/workflow/examples[here]

Review Comment:
   I agree, let me move this classes to our examples repo and link them properly



-- 
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] [KOGITO-9454] Documenting java flow library [incubator-kie-kogito-docs]

Posted by "fjtirado (via GitHub)" <gi...@apache.org>.
fjtirado commented on code in PR #585:
URL: https://github.com/apache/incubator-kie-kogito-docs/pull/585#discussion_r1526343238


##########
serverlessworkflow/modules/ROOT/pages/getting-started/java-embedded-workflows.adoc:
##########
@@ -0,0 +1,104 @@
+= Workflow embedded execution in Java 
+
+This guide show cases how to execute a link:{spec_doc_url}[CNCF Serverless Workflow] definition using a standard java virtual machine and a small set of Maven dependencies. Therefore, it is assumed you are fluent both in Java and Maven. 
+The workflow definition to be executed can be read from a .json or .yaml file or programatically defined using the {product_name} fluent API. 
+
+[[embedded-file-quick-start]]
+== Hello world (using existing definition file)
+
+First step is to setup an empty Maven project with the following dependency. 
+
+[source,xml]
+----
+<dependency>
+  <groupId>org.kie.kogito</groupId>
+  <artifactId>kogito-serverless-workflow-executor-core</artifactId>
+  <version>RELEASE</version>
+</dependency>
+----
+
+Also, you might optionally add `simple logger for java` dependency to avoid using `system.out.println`
+
+[source,xml]
+----
+ <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>1.7.36</version>
+  </dependency>
+----
+
+Lets assume you already have a workflow definition written in a JSON file in your project root. For example, link:{kogito_sw_examples_url}/serverless-workflow-hello-world/src/main/resources/hello.sw.json[Hello World] definition. In order to execute it, you need to write the following main java class (standard imports and java package declaration are intentionally skipped for brevity)
+
+[source,java]
+----
+import org.kie.kogito.serverless.workflow.executor.StaticWorkflowApplication;
+import org.kie.kogito.serverless.workflow.models.JsonNodeModel;
+import org.kie.kogito.serverless.workflow.utils.ServerlessWorkflowUtils;
+import org.kie.kogito.serverless.workflow.utils.WorkflowFormat;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.serverlessworkflow.api.Workflow;
+
+public class DefinitionFileExecutor {
+    private static final Logger logger = LoggerFactory.getLogger(DefinitionFileExecutor.class);
+
+    public static void main(String[] args) throws IOException {
+        try (Reader reader = new FileReader("hello.sw.json"); <1>
+                StaticWorkflowApplication application = StaticWorkflowApplication.create()) { <2>
+            Workflow workflow = ServerlessWorkflowUtils.getWorkflow(reader, WorkflowFormat.JSON); <3>
+            JsonNodeModel result = application.execute(workflow, Collections.emptyMap()); <4>
+            logger.info("Workflow execution result is {}", result.getWorkflowdata()); <5>
+        }
+    }
+}
+----
+<1> Reads the workflow file definition from the project root directory
+<2> Creates a static workflow application object. It is done within the try block since the instance is `Closeable`. This is the reference that allow you to execute workflow definitions.
+<3> Reads the Serverless Workflow Java SDK `Workflow` object from the file. 
+<4> Execute the workflow, passing `Workflow` reference and no parameters (an empty Map). The result of the workflow execution: process instance id and workflow output model, can accessed using `result` variable. 
+<5> Prints the workflow model in the configured standard output. 
+
+If you compile and execute this java class, you will see the following log in your configured standard output
+----
+Workflow execution result is {"greeting":"Hello World","mantra":"Serverless Workflow is awesome!"}
+----
+
+[[embedded-fluent-quick-start]]
+== Hello world (using fluent API)
+
+Using the same Maven setup than in the previous section, you can programatically generate that workflow definition rather than loading it from a file definition by using link:{kogito_runtimes_url}/kogito-serverless-workflow/kogito-serverless-workflow-fluent/src/main/java/org/kie/kogito/serverless/workflow/fluent[fluent API]
+
+Therefore, you can modify the previous example in a way that generates exactly the same output when it is executed, but rather creating a `FileReader` that reads the `Workflow` object, we create the `Workflow` object using java statements. The resulting modified main method is the following
+
+[source,java]
+----
+      try (StaticWorkflowApplication application = StaticWorkflowApplication.create()) {
+            Workflow workflow = workflow("HelloWorld"). <1>
+            		start( <2>
+            				inject( <3>
+            						jsonObject().put("greeting", "Hello World").put("mantra","Serverless Workflow is awesome!"))) <4>
+            		.end() <5>
+            		.build(); <6>
+            logger.info("Workflow execution result is {}",application.execute(workflow, Collections.emptyMap()).getWorkflowdata());  <7>
+        }
+----
+<1> Creates a workflow which name is `HelloWorld`
+<2> Indicate that you are going to specify the start state
+<3> A Inject state is the start state
+<4> Inject state accepts static json, therefore this line creates the JSON data
+<5> End the workflow definition 
+<6> Build the workflow definition
+<7> Execute and print as in previous example
+
+
+== Additional resources
+
+You can find additional and commented examples of fluent API usage (including jq expression evaluation and orchestation of rest services) link:https://github.com/fjtirado/java-flow/tree/main/java-flow-example/src/main/java/org/kie/kogito/serverless/workflow/examples[here]

Review Comment:
   Created https://github.com/apache/incubator-kie-kogito-examples/pull/1895 for adding the examples



-- 
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