martinweiler commented on code in PR #1833:
URL:
https://github.com/apache/incubator-kie-kogito-examples/pull/1833#discussion_r1468205026
##########
kogito-quarkus-examples/process-usertasks-timer-data-index-persistence-addon-quarkus/README.md:
##########
@@ -0,0 +1,539 @@
+# Process user tasks with timer with persistence addon : Hiring
+
+## Description
+
+This example showcases a basic implementation of the **Hiring** process that
drives a *Candidate* through different
+interviews until he gets hired.
+
+This quickstart project shows a simple example user task orchestration
including the use of DMN decisions to
+generate the candidate offer and timers to skip User Tasks.
+
+This example also demonstrates how to configure the whole *Kogito* environment
using the new *Simplified Architecture* that
+enable simplifying the communication among *Kogito* services removing the need
of events (Kafka/HTTP) between them. This can
+be achieved using the following *Quarkus* addons:
+- `kogito-addons-quarkus-data-index-persistence-postgresql`: enables the
*Kogito Runtime* persisting directly into the
+*Data-Index* database.
+- `kogito-addons-quarkus-jobs`: enables collocating the *Jobs Service* inside
the *Kogito Runtime*.
+
+## The Java models
+
+The **Hiring** process uses two POJOs to handle the process data, both of them
can be found in the *org.kie.kogito.hr* package.
+
+The `CandidateData` POJO is the input of the process. It represents the person
that wants to get the job.
+
+```java
+public class CandidateData {
+
+ private String name; // Name of the candidate
+ private String lastName; // Last name of the candidate
+ private String email; // Email of the candidate
+ private Integer experience; // Years of experience
+ private List<String> skills; // List of technical skills
+
+ // Constructors, setters, getters...
+}
+```
+
+The `Offer` POJO is the output of the process and represents the job offer
that will be sent to the candidate.
+It will be automatically calculated during the process execution depending on
the candidate years of experience & skills.
+```java
+public class Offer {
+
+ private String category; // Job category based on the candidate experience
+ private Integer salary; // Salary based on the candidate experience and
skills
+
+ // Constructors, setters, getters...
+}
+```
+## The *New Hiring Offer* DMN
+This example makes use of the *New Hiring Offer* DMN to generate a base offer
for the `Candidate`. The DMN looks like this:
+
+In this simple DMN we have an `Offer` *Decision*, that will generate the
candidate offer, which
+has a requirement of a `CandidateData` *Input Data*.
+
+<div style="text-align:center">
+ <figure>
+ <img width=55% src="docs/images/new_hiring_offer_dmn.png" alt="DMN
Diagram">
+ <figcaption>New Hiring Offer DMN diagram</figcaption>
+ </figure>
+</div>
+
+The DMN defines the following data types (`tCandidateData` & `tOffer` )
matching the POJOs defined in the project
+(`CandidateData.java` & `Offer.java`):
+
+<div style="text-align:center">
+ <figure>
+ <img width=75% src="docs/images/new_hiring_offer_dmn_types.png"
alt="DMN Type Definitions">
+ <figcaption>New Hiring Offer DMN types</figcaption>
+ </figure>
+</div>
+
+As expected, `CandidateData` *Input Data* & `Offer` *Decision* have a
`tCandidateData` data
+
+The `Offer` decision uses the following *Boxed Expression* to generate the
`tOffer`:
+
+<div style="text-align:center">
+ <figure>
+ <img width=75% src="docs/images/new_hiring_offer_dmn_decision.png"
alt="DMN Decision">
+ <figcaption>New Hiring Offer DMN decision</figcaption>
+ </figure>
+</div>
+
+## The Hiring Process
+### Process variables
+
+The process handles the following _Variables_:
+
+| Variable | Type | Tags |
Description |
+|--------------------|-----------------------------------|--------------|---------------------------------------------------|
+| **candidateData** | `org.kie.kogito.hr.CandidateData` | **input** | The
candidate data |
+| **offer** | `org.kie.kogito.hr.Offer` | **output** | The
generated candidate offer |
+| **hr_approval** | `Boolean` | **internal** |
Determines that HR department approves the hiring |
+| **it_approval** | `Boolean` | **internal** |
Determines that IT department approves the hiring |
+
+### The BPMN Process
+
+<div style="text-align:center">
+ <figure>
+ <img width=75% src="docs/images/hiring_diagram.png" alt="Hiring Process
Diagram">
+ <figcaption>Hiring Process Diagram</figcaption>
+ </figure>
+</div>
+
+The process starts receiving the `CandidateData` as an input and storing it
into the `candidateData` variable, and if the
+candidate meets two minimal requirements, the process will continue and reach
the **Generate base offer**, otherwise the
+candidate application will be denied and the process will complete without
sending the `offer` to the candidate.
+
+The **Generate base offer** is a *Business Rule Task* that will use the *New
Hiring Offer* decision defined in the
+`NewHiringOffer.dmn` to generate the an `Offer` based on the candidate
experience and skills. The task takes the `candidateData`
+as an input and will produce an instance of `org.kie.kogito.hr.Offer` that
will be stored in the `offer` variable.
+
+
+<div style="text-align:center">
+ <figure>
+ <img width=75% src="docs/images/generate_offer_assignments.png"
alt="Offer assignments">
+ <figcaption><b>Generate base Offer</b> data assignments</figcaption>
+ </figure>
+</div>
+
+After the `offer` has been generated, the process will jump into the **HR
Interview** *User Task*, where the candidate we'll
+be interviewed by the *HR* department. The task takes the `candidateData` and
`offer` as inputs and as an output will produce
+the `hr_approve` boolean and an updated `offer`.
+
+<div style="text-align:center">
+ <figure>
+ <img width=75% src="docs/images/hr_interview_assignments.png" alt="HR
Interview assignments">
+ <figcaption><b>HR Interviewr</b> task data assignments</figcaption>
+ </figure>
+</div>
+
+The **HR Interview** *User Task* also has a *Boundary Timer Event* that will
prevent the task to delay and will cancel the
+task after certain time (for example purpose just 3 minutes). This *Boundary
Timer Event* will schedule a Job in the Jobs Service
+that when trigger will notify the *Kogito Runtime* to cancel the task and
deny the application.
+
+If **HR Interview** successfully completed, the process will jump into the
**IT Interview** *User Task*. Again the candidate
+we'll have a second interview with the *IT* department. Again, this task will
take the `candidateData` and `offer` as inputs
+but as an output will produce the `it_approve` boolean.
+
+<div style="text-align:center">
+ <figure>
+ <img width=75% src="docs/images/it_interview_assignments.png" alt="IT
Interview assignments">
+ <figcaption><b>IT Interviewr</b> task data assignments</figcaption>
+ </figure>
+</div>
+
+
+Once both tasks are completed, if the candidate got the approvals from *HR* &
*IT* (both `hr_interview` & `hr_interview` being true)
+the process will jump into the **Send Offer to Candidate** *Script Task* that
will notify the candidate about the offer
+and the process will end.
+
+> **NOTE:** for simplicity, all the *User Tasks* in this example are assigned
to the *jdoe* user present in the keycloak configuration
+
+## Running the example
+### Prerequisites
+
+* Java 17+ installed
+* Environment variable JAVA_HOME set accordingly
+* Maven 3.9.3+ installed
+* Docker and Docker Compose to run the required example infrastructure.
+
+And when using native image compilation, you will also need:
+- GraalVM 20.3+ installed
+- Environment variable GRAALVM_HOME set accordingly
+- GraalVM native image needs as well native-image extension:
https://www.graalvm.org/reference-manual/native-image/
+- Note that GraalVM native image compilation typically requires other packages
(glibc-devel, zlib-devel and gcc) to be installed too, please refer to GraalVM
installation documentation for more details.
+
+### Infrastructure Services
+
+This quickstart provides a docker compose template that starts all the
required services. This setup ensures that all services are connected with a
default configuration.
+
+- PostgreSQL: 5432
+- Kafka: 9092
Review Comment:
remove kafka
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]