Skip to main content
This guide walks you through creating a Business Process Model and Notation (BPMN) workflow for an employee onboarding process. You’ll learn how to design, implement, and execute a process that orchestrates both human and automated tasks.

Example Use Case: Employee Onboarding

Our employee onboarding process includes these key steps:
  1. HR initiates the onboarding process with new employee information
  2. IT department prepares equipment and accounts in parallel with HR paperwork
  3. The manager reviews and approves the onboarding plan
  4. Automated notifications are sent to relevant departments
  5. The new employee completes required training
  6. The process concludes with a feedback collection step

Version 1: Using Aletyx Playground

Step 1: Access Aletyx Playground

  1. Navigate to playground.aletyx.ai or run locally:
  1. From the welcome screen, click Create Project
  2. Name your project “EmployeeOnboarding” and provide a description
  3. Click Create

Step 2: Create a New BPMN Model

  1. Click New File and select Workflow (BPMN)
  2. Name your workflow “employee-onboarding.bpmn”
  3. Click Create

Step 3: Design the Onboarding Process

Let’s build the process diagram:
  1. Start Event:
  2. Drag a Start Event from the palette
  3. Name it “New Employee Hire”
  4. In the properties panel, add a process variable: employee (type: Object)
  5. HR Onboarding Task:
  6. Drag a User Task and connect it to the Start Event
  7. Name it “Complete HR Paperwork”
  8. In the properties panel:
  • Actors: HR (the group responsible)
  • Data assignments:
  • Input: employee (map from process variable)
  • Output: hrComplete (Boolean)
  1. Parallel Gateway (Split):
  2. Drag a Parallel Gateway after the HR task
  3. Connect it to the HR task
  4. IT Setup Task (one branch of parallel execution):
  5. Drag a User Task and connect it to the Parallel Gateway
  6. Name it “Prepare IT Equipment and Accounts”
  7. In the properties panel:
  • Actors: IT (the group responsible)
  • Data assignments:
  • Input: employee (map from process variable)
  • Output: itComplete (Boolean)
  1. Add Equipment Timer:
  2. Add a Boundary Timer Event to the IT task
  3. Set timer to ISO-8601: PT3D (3 days)
  4. Connect it to an “IT Setup Escalation” Script Task
  5. In the Script Task, add a script to send an escalation email
  6. Training Setup Task (another branch of parallel execution):
  7. Drag a Service Task and connect it to the Parallel Gateway
  8. Name it “Schedule Required Training”
  9. In the properties panel:
  • Implementation: Java Class
  • Class name: ai.aletyx.onboarding.TrainingService
  • Method: scheduleTraining
  • Data assignments:
  • Input: employee (map from process variable)
  • Output: trainingScheduled (Boolean)
  1. Parallel Gateway (Join):
  2. Drag another Parallel Gateway
  3. Connect both the IT task and Training Service task to this gateway
  4. Manager Approval Task:
  5. Drag a User Task and connect it to the Join Gateway
  6. Name it “Manager Review and Approval”
  7. In the properties panel:
  • Actors: #{employee.departmentManager} (dynamic assignment)
  • Data assignments:
  • Input: employee, hrComplete, itComplete, trainingScheduled
  • Output: managerApproved (Boolean)
  1. Exclusive Gateway (Decision):
  2. Drag an Exclusive Gateway after the Manager Approval
  3. Create two paths:
  • Path 1: Condition managerApproved == true
  • Path 2: Condition managerApproved == false (returns to HR task)
  1. Send Welcome Email Task:
  • Drag a Service Task on the approval path
  • Name it “Send Welcome Email”
  • Implementation: Java Class
  • Class name: ai.aletyx.onboarding.NotificationService
  • Method: sendWelcomeEmail
  1. Employee Training Task:
  • Drag a User Task after the Welcome Email task
  • Name it “Complete Required Training”
  • Actors: #{employee.username}
  • Add a form with training checklist
  1. End Event:
  • Drag an End Event and connect it to the Training task
  • Name it “Onboarding Complete”
  1. Save the model

Step 4: Create Required Java Classes

Create these Java files in your project: Employee.java
TrainingService.java
NotificationService.java

Step 5: Deploy and Test the Workflow

  1. Click Deploy to create a dev deployment
  2. Once deployed, use the test interface to start a new process instance:
  3. Enter sample employee data:
  1. Navigate to the Task list to see and complete the “HR Paperwork” task
  2. Continue through the process, completing the IT setup and manager approval tasks
  3. Observe how the process flows through the various paths based on your inputs

Version 2: Java 17 Project with Maven

Step 1: Create a Maven Project

  1. Create a new Maven project with the following structure:
  1. Set up your pom.xml:

Step 4: Create the BPMN Process File

  1. Place your BPMN process file in src/main/resources/employee-onboarding.bpmn
  2. You can either:
  3. Export the BPMN file from the Aletyx Playground after designing it there
  4. Use a BPMN editor to create the process and export it
  5. The BPMN file should contain all the elements we designed in the Playground version:
  6. Start event for “New Employee Hire”
  7. User task for “Complete HR Paperwork”
  8. Parallel gateway for splitting the flow
  9. User task for “Prepare IT Equipment and Accounts” with boundary timer
  10. Service task for “Schedule Required Training”
  11. Parallel gateway for joining the flows
  12. User task for “Manager Review and Approval”
  13. Exclusive gateway for the approval decision
  14. Service task for “Send Welcome Email”
  15. User task for “Complete Required Training”
  16. End event for “Onboarding Complete”
  17. For full BPMN file content, refer to the sample onboarding process file

Step 5: Create the REST Resource

Create a REST resource to expose the process API: OnboardingProcessResource.java

Step 6: Create the Process Model Class

Create a model class to represent the process variables: EmployeeOnboardingModel.java

Step 7: Create the Application Main Class

Create or update the main application class: OnboardingApplication.java

Step 8: Create a Simple Test Case

OnboardingProcessTest.java

Step 9: Run the Application

  1. Start the application:
  1. Access the Swagger UI to test the API:
  2. Open http://localhost:8080/q/swagger-ui
  3. Use the /onboarding/start endpoint to start a new process
  4. Check the process instance with /onboarding/{id}
  5. Access the Task UI (if you’ve added the Quarkus task console extension):
  6. Open http://localhost:8080/q/dev-ui/task-console
  7. Complete tasks in the onboarding process

Step 10: Deploying to Production

  1. Build a native executable for optimal performance:
  1. Create a Docker image:
  1. Deploy to Kubernetes:

Advanced Features

Adding Process Metrics

To track process performance, add the Quarkus Micrometer extension and configure process metrics:
  1. Add the dependency:
  1. Configure metrics in application.properties:
  1. Access metrics at /q/metrics

Task Assignment Strategies

Implement custom task assignment strategies:
  1. Create a TaskAssignmentStrategy class:
  1. Register your strategy with the task assignment service

Process Monitoring and Administration

For enterprise deployments, consider adding:
  1. Kogito Management Console for process monitoring
  2. Kogito Task Console for task management
  3. Infinispan or Redis for process state persistence
  4. Kafka for event-driven process communication

Benefits of BPMN Workflows

  • Standardized Notation: BPMN is an industry-standard understood by business and technical teams
  • Process Visualization: Graphical representation makes complex workflows easier to understand
  • Execution Control: Fine-grained control over process flow, parallel execution, and decision points
  • Human and System Tasks: Seamless integration of manual and automated activities
  • Event Handling: Built-in handling of timers, signals, messages, and errors
  • Monitoring and Reporting: Process analytics and KPIs for continuous improvement
  • Flexibility: Easily modify processes without changing application code