Example Use Case: Employee Onboarding
Our employee onboarding process includes these key steps:- HR initiates the onboarding process with new employee information
- IT department prepares equipment and accounts in parallel with HR paperwork
- The manager reviews and approves the onboarding plan
- Automated notifications are sent to relevant departments
- The new employee completes required training
- The process concludes with a feedback collection step
Version 1: Using Aletyx Playground
Step 1: Access Aletyx Playground
- Navigate to playground.aletyx.ai or run locally:
- From the welcome screen, click Create Project
- Name your project “EmployeeOnboarding” and provide a description
- Click Create
Step 2: Create a New BPMN Model
- Click New File and select Workflow (BPMN)
- Name your workflow “employee-onboarding.bpmn”
- Click Create
Step 3: Design the Onboarding Process
Let’s build the process diagram:- Start Event:
- Drag a Start Event from the palette
- Name it “New Employee Hire”
- In the properties panel, add a process variable:
employee(type: Object) - HR Onboarding Task:
- Drag a User Task and connect it to the Start Event
- Name it “Complete HR Paperwork”
- In the properties panel:
- Actors:
HR(the group responsible) - Data assignments:
- Input:
employee(map from process variable) - Output:
hrComplete(Boolean)
- Parallel Gateway (Split):
- Drag a Parallel Gateway after the HR task
- Connect it to the HR task
- IT Setup Task (one branch of parallel execution):
- Drag a User Task and connect it to the Parallel Gateway
- Name it “Prepare IT Equipment and Accounts”
- In the properties panel:
- Actors:
IT(the group responsible) - Data assignments:
- Input:
employee(map from process variable) - Output:
itComplete(Boolean)
- Add Equipment Timer:
- Add a Boundary Timer Event to the IT task
- Set timer to ISO-8601:
PT3D(3 days) - Connect it to an “IT Setup Escalation” Script Task
- In the Script Task, add a script to send an escalation email
- Training Setup Task (another branch of parallel execution):
- Drag a Service Task and connect it to the Parallel Gateway
- Name it “Schedule Required Training”
- 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)
- Parallel Gateway (Join):
- Drag another Parallel Gateway
- Connect both the IT task and Training Service task to this gateway
- Manager Approval Task:
- Drag a User Task and connect it to the Join Gateway
- Name it “Manager Review and Approval”
- In the properties panel:
- Actors:
#{employee.departmentManager}(dynamic assignment) - Data assignments:
- Input:
employee,hrComplete,itComplete,trainingScheduled - Output:
managerApproved(Boolean)
- Exclusive Gateway (Decision):
- Drag an Exclusive Gateway after the Manager Approval
- Create two paths:
- Path 1: Condition
managerApproved == true - Path 2: Condition
managerApproved == false(returns to HR task)
- 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
- 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
- End Event:
- Drag an End Event and connect it to the Training task
- Name it “Onboarding Complete”
- Save the model
Step 4: Create Required Java Classes
Create these Java files in your project: Employee.javaStep 5: Deploy and Test the Workflow
- Click Deploy to create a dev deployment
- Once deployed, use the test interface to start a new process instance:
- Enter sample employee data:
- Navigate to the Task list to see and complete the “HR Paperwork” task
- Continue through the process, completing the IT setup and manager approval tasks
- 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
- Create a new Maven project with the following structure:
- Set up your
pom.xml:
Step 4: Create the BPMN Process File
- Place your BPMN process file in
src/main/resources/employee-onboarding.bpmn - You can either:
- Export the BPMN file from the Aletyx Playground after designing it there
- Use a BPMN editor to create the process and export it
- The BPMN file should contain all the elements we designed in the Playground version:
- Start event for “New Employee Hire”
- User task for “Complete HR Paperwork”
- Parallel gateway for splitting the flow
- User task for “Prepare IT Equipment and Accounts” with boundary timer
- Service task for “Schedule Required Training”
- Parallel gateway for joining the flows
- User task for “Manager Review and Approval”
- Exclusive gateway for the approval decision
- Service task for “Send Welcome Email”
- User task for “Complete Required Training”
- End event for “Onboarding Complete”
- 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.javaStep 6: Create the Process Model Class
Create a model class to represent the process variables: EmployeeOnboardingModel.javaStep 7: Create the Application Main Class
Create or update the main application class: OnboardingApplication.javaStep 8: Create a Simple Test Case
OnboardingProcessTest.javaStep 9: Run the Application
- Start the application:
- Access the Swagger UI to test the API:
- Open http://localhost:8080/q/swagger-ui
- Use the
/onboarding/startendpoint to start a new process - Check the process instance with
/onboarding/{id} - Access the Task UI (if you’ve added the Quarkus task console extension):
- Open http://localhost:8080/q/dev-ui/task-console
- Complete tasks in the onboarding process
Step 10: Deploying to Production
- Build a native executable for optimal performance:
- Create a Docker image:
- Deploy to Kubernetes:
Advanced Features
Adding Process Metrics
To track process performance, add the Quarkus Micrometer extension and configure process metrics:- Add the dependency:
- Configure metrics in
application.properties:
- Access metrics at
/q/metrics
Task Assignment Strategies
Implement custom task assignment strategies:- Create a TaskAssignmentStrategy class:
- Register your strategy with the task assignment service
Process Monitoring and Administration
For enterprise deployments, consider adding:- Kogito Management Console for process monitoring
- Kogito Task Console for task management
- Infinispan or Redis for process state persistence
- 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