Getting Started with the Aletyx Enterprise Build of Kogito and Drools Quarkus Maven Archetype to try the Adaptive Process Architecture with Quarkusโข¶
This guide demonstrates how to use the Aletyx Enterprise Build of Kogito and Drools Quarkus Maven Archetype to create a fully-configured business automation project quickly to see how process can be built with mvn quarkus:dev
and the Adaptive Process Architecture.
Introduction¶
The Aletyx Enterprise Build of Kogito and Drools Quarkus Maven Archetype Quarkus Maven Archetype provides a standardized template for creating new Kogito/jBPM projects with a focus on business automation. The archetype creates two distinct architectures you can try as a developer:
- Using
mvn quarkus:dev
to see how the Quarkus Developer UI Tools work, located at http://localhost:8080/q/dev-ui - Using a combination of
mvn clean install
anddocker compose up --build
to build a local version of the Adaptive Process Architecture with the components to mimic how your process could look.
Within these configurations, the associated datasources are created attached to the environments. For mvn quarkus:dev
this is a local, non-persisted instance that will go away when your service stops. With the Adaptive Process Architecture version, a PostgreSQL container is built with the appropriate SQL required for it to work within the docker-compose.yaml. This process helps mimic what would be used when deployed to your container platform of choice.
Prerequisites¶
Before starting, ensure you have the following installed:
- Javaโข 17 or higher
- Apache Mavenโข 3.9.6+
- Dockerยฎ and Docker Composeโข (for containerized deployment)
- PostgreSQLยฎ (optional, for local development without containers)
Creating a New Project¶
Step 1: Generate the Project¶
Run the following command to create a new project using the Aletyx Enterprise Build of Kogito and Drools Quarkus Maven Archetype:
mvn archetype:generate \
-DarchetypeGroupId=ai.aletyx.archetypes \
-DarchetypeArtifactId=quarkus-kogito-jbpm-archetype \
-DarchetypeVersion=1.0.0 \
-DgroupId=com.example \
-DartifactId=my-kogito-app \
-Dversion=1.0.0-SNAPSHOT \
-Dpackage=com.example.test \
-DkogitoVersion=10.0.0 \
-DquarkusVersion=3.15.3
This command will: 1. Connect to the repository containing the archetype 2. Download the archetype 3. Generate a new project based on the archetype template 4. Customize the project with the parameters you provided at the artifactId folder in the directory this is ran from.
Step 2: Explore the Generated Project¶
Navigate to the newly created project directory:
The generated project will have the following structure:
my-kogito-app/
โโโ Dockerfile # Docker file for containerization
โโโ README.md # Project README with usage instructions
โโโ docker-compose.yaml # Docker Compose configuration
โโโ docker-compose/ # Docker Compose supporting files
โ โโโ pgadmin/ # pgAdmin configuration
โ โ โโโ pgpass
โ โ โโโ servers.json
โ โโโ postgres/ # PostgreSQL configuration
โ โโโ Dockerfile
โ โโโ sql/ # SQL initialization scripts
โ โโโ 01_init.sql
โ โโโ data-audit.sql
โ โโโ data-index.sql
โ โโโ jobs-service.sql
โ โโโ runtime-persistence.sql
โ โโโ user-tasks.sql
โโโ pom.xml # Project POM file
โโโ src/
โโโ main/
โ โโโ java/ # Java source files
โ โ โโโ listeners/ # Process event listeners
โ โ โ โโโ MinimalClaimListener.java
โ โ โโโ model/ # Domain model classes
โ โ โโโ Policy.java
โ โโโ resources/ # Resource files
โ โโโ application.properties # Application configuration
โ โโโ claim_initiation.bpmn # Sample BPMN process
โโโ test/ # Test files
โโโ java/
โโโ resources/
Running the Application in Development Mode¶
Step 1: Start the Development Server¶
Run the following command to start the application in development mode:
This will start a development server with hot reloading enabled.
Step 2: Access the Application¶
Once the application is running, you can access:
- Application API: http://localhost:8080
- Swagger UI: http://localhost:8080/q/swagger-ui
- Dev UI: http://localhost:8080/q/dev-ui
Step 3: Test the Sample Process¶
- Navigate to the Swagger UIโข at http://localhost:8080/q/swagger-ui
- Find the "claim_initiation" process endpoint
- Create a new process instance by sending a request with "Home" as the claimType
- The process will create a user task assigned to user "jdoe"
- You can claim and complete the task by impersonating as "jdoe"
Running with Docker Compose¶
For a full deployment including PostgreSQL persistence and the Kogito Management Console:
Step 1: Build the Application¶
First, build the application:
Step 2: Start the Docker Compose Environment¶
Launch all services using Docker Compose:
This will start: - PostgreSQL database (port 5432) - Your application (port 8080) - Kogito Management Console (port 8280) - pgAdmin (port 8055)
Step 3: Access the Services¶
- Application API: http://localhost:8080
- Swagger UI: http://localhost:8080/q/swagger-ui
- Management Console: http://localhost:8280
- pgAdmin: http://localhost:8055 (login with user@kie.org / pass)
Step 4: Test the Application¶
- Navigate to http://localhost:8080/q/swagger-ui
- Test the claim_initiation process (use "Home" for the claimType)
- Navigate to http://localhost:8280 to open the Management Console
- Connect to a new service at http://localhost:8080
- Monitor the process instance in the Management Console
- Complete the task by impersonating as user "jdoe"
- Verify the process is completed in the Management Console
Customizing the Project¶
Adding New Processes¶
- Create new BPMNโข files in
src/main/resources
- They will be automatically compiled and deployed when the application starts
Creating Process Event Listeners¶
- Create a new class that extends
DefaultKogitoProcessEventListener
- Annotate it with
@ApplicationScoped
- Override the desired event methods, such as:
beforeProcessStarted
afterProcessStarted
beforeTaskCompleted
afterTaskCompleted
Example:
@ApplicationScoped
public class MyProcessListener extends DefaultKogitoProcessEventListener {
private static final Logger LOGGER = LoggerFactory.getLogger(MyProcessListener.class);
@Override
public void afterProcessStarted(ProcessStartedEvent event) {
LOGGER.info("Process started: {}", event.getProcessInstance().getProcessId());
}
@Override
public void afterTaskCompleted(TaskCompletedEvent event) {
LOGGER.info("Task completed: {}", event.getTask().getName());
}
}
Deployment Options¶
The generated project supports several deployment options:
Local Development¶
Use the default profile for local development with in-memory persistence:
Docker Compose¶
Use the compose profile for containerized deployment with PostgreSQL:
Red Hat OpenShiftยฎ Deployment¶
Use the Red Hat OpenShiftยฎ profile for deploying to OpenShift:
Conclusion¶
The Aletyx Enterprise Build of Kogito and Drools Quarkus Maven Archetype provides a comprehensive starting point for building business automation applications with Kogito, jBPM, and Quarkus. By using this archetype, you can quickly set up a project with all the necessary components for workflow automation, decision management, and business rules processing.