Eric D. Schabell: CodeReady Containers - Building a Human Resources Process with an OpenShift Operator

Monday, December 28, 2020

CodeReady Containers - Building a Human Resources Process with an OpenShift Operator

rewards process
Previously I've shared a cloud-native HR rewards process as an example project to run on the Openshift Container Platform. 

What's the next evolution?

There is no better way to learn about container technologies, cloud native methods, and container-based application development than getting hands-on with great open technologies. This article dives into building this process using the provided OpenShift business automation operator.

This article targets getting you started on your new OpenShift Container Platform 4.6 by putting the latest process automation developer tooling at your disposal together with a real project for you to deploy and explore.  Even better, if you need more help getting started, we'll provide a free online workshop where you can build this project yourself.

This articles outlines getting started with the HR Employee Rewards project on the above installation as default, though you can point this installation to any existing OpenShift Container Platform (pass an IP address). Let's get started right now exploring the new developer tooling for process design, user tasks, forms, rules, and business logic in just a few simple steps.

Process automation developer tooling


rewards process
This is how it's going to work, first we're installing the Red Hat Process Automation Manager on an OpenShift Container Platform using the latest provided container catalog image. Next, we're using that tooling API to import the HR employee rewards project. 

This means upon logging in, you'll find a project ready to go and it delivers on the promise of a fully functioning developer process automation tooling containerized on your OpenShift Container Platform.

Install on CodeReady Containers

There are two options to install and run this project on the OpenShift Container Platform; use your own existing installation or to install on CodeReady Containers which provides you with a local OpenShift cluster.
rewards process
  1. Ensure you have installed OpenShift with CodeReady Containers Easy Install

  2. Download and unzip this demo.

  3. Run 'init.sh' or 'init.bat' file. 'init.bat' must be run with Administrative privileges.

Log in to the HR Rewards project to start exploring an online employee rewards application (the address will be generated by the init script):

Want to build the Rewards demo from scratch? Try this hands-on online workshop.


Running the rewards process

  1. Click on the "rewards" project to open the project.

  2. The project has a data model (Award and Employee), task forms, and a rewards approval process.

  3. There are two EMAIL tasks configured to send email (for the linked workshop), but we want to mock them off to instead log the email to the server we deploy to. To do this go to the rewards project SETTINGS -> DEPLOYMENT -> WORK ITEM HANDLERS where you'll see an EMAIL task entry. Change the entries by replacing them with the folowing below and click on SAVE button:

    Name:          Email
    Value:         new org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler()
    Resolver type: MVEL  
  4. Build and deploy version 1 of the project. Click on the "Build and Deploy" in the upper right corner.

  5. Go to "Menu -> Deploy -> Execution Servers" repository to see the rewards_1.0.0 Kie Container deployed on the Process Automation Server.

  6. Go to "Menu -> Manage -> Process Definitions" to see the rewards-approval process version 1.0 has been deployed.

    rewards process

  7. Click on the process definition line, then start a New Process Instance with button in the top right corner.

  8. Fill in the Employee Reward form as follows and click on Submit button:

    Name: Eric D. Schabell
    
    Department: IT
    
    Award amount: 100
    
    Explanation: Good work on demo
  9. Go to "Menu -> Manage -> Process Instances" and select the process instance listed as running that you just started. This give the options to look at Instance Details, Process Variables, Documents, Logs, and Diagrams. Let's look at where this process is right now by selecting the Diagrams tab.

  10. The red box around the "Approve Reward" task means we need to decide if the employee is to receive the award or not, so go to the "Menu -> Manage -> Tasks" and selecting the waiting task.

  11. Click on "Claim" button at the bottom followed by clicking on the "Start" task button (standards-based user task completion steps mandate these phase labels for tasks) to edit the provided task form field. There is only one field to edit, so check the Approval box (you can leave blank to reject an award).

  12. After submitting the form by clicking on the "Complete" button go to "Menu -> Manage -> Process Instances" and in the filters panel on the left put a check-box in the "Completed" field to view completed process instances. Find your just completed process instance, select it from the list, and open the "Diagram" tab to view the greyed out boxes that depict the path taken through this process. You should see that this employee reward has completed in the "End Accepted" final end node of the process.

  13. To see the Email task results you can use the 'oc get pods' command to find the 'rewards-kieserver-#-#####' and then view the logs to see the email was sent using the mocked logging feature from above, something like this (your pod number will be different:

     $ oc get pods
    
     NAME                                            READY   STATUS      RESTARTS   AGE
     business-automation-operator-7ddc5869c8-m655d   1/1     Running     0          34m
     console-cr-form                                 2/2     Running     0          33m
     rewards-kieserver-1-deploy                      0/1     Completed   0          33m
     rewards-kieserver-1-f77k7                       1/1     Running     0          19m
     rewards-rhpamcentr-1-deploy                     0/1     Completed   0          33m
     rewards-rhpamcentr-1-tmvvp                      1/1     Running     0          33m
    
     
     $ oc logs rewards-kieserver-1-f77k7
    
     13:52:52,653 INFO [stdout] (default task-5) Executing work item WorkItem 6 [name=Email, state=0, processInstanceId=3, 
     parameters{From=hr@company.com, To=Eric D. Schabell@company.com, TaskName=Email, Body=We are happy to inform you 
     that your reward submission was approved and will soon be deposited to your bank account!, 
     Subject=Your reward was approved!}]

Hope you enjoy this process project and that it helps you to get started in the cloud-native business automation world.