Saturday, September 20, 2014

3 Essential Ways To Start Your JBoss BPM Process

This episode of tips and tricks will help you to understand the best way to initiate your process instances for your needs.

Planning your projects might include process projects, but have you thought about the various ways that you can initiate your process?

Maybe you have JBoss BPM Suite running locally in your architecture, maybe you have it running in the Cloud, but wherever it is you will still need to make an informed choice about how to initiate a process.

We will cover here three essential ways you can best start a JBoss BPM process:
  1. UI dashboard
  2. RestAPI
  3. Build & Deploy button top right.
  4. client application (API)

BPM Suite UI

In the interest of completeness we have to mention the ability to start a process instance exists in the form of a button within JBoss BPM Suite dashboard tooling.

When logged into JBoss BPM Suite and you have finished project development, your BPM project can then be built and deployed as follows.


The next step is to start a process instance in the process management perspective in one of two ways.


 2. PROCESS MANAGEMENT -> PROCESS DEFINITIONS -> magnifying-glass-icon -> in DETAILS panel -> NEW INSTANCE (button)

Process definitions has start icon in right corner.
Both of these methods will result in a process instance being started, popping up a start form if data is to be submitted to the BPM process.


Assuming you are going to be calling for a start of your BPM process after deployment from various possible locations we wanted to show you how these might be easily integrated.

Details view of process definition has 'New Instance' button.
It does not matter if you are starting a process from a web application, a mobile application or creating backend services for your enterprise to use as a starting point for processes. The exposed RestAPI provides the perfect way to trigger your BPM process and can be show in the following code example.

This example is a very simple Rest client that, for clarity, will be embedding the various variables one might pass to such a client directly into the example code. There are no variables passed to the process being started, for that we will provide a more complete example in the section covering a client application.

It sends a start process command and expects no feedback from the Customer Evaluation BPM process being called, as it is a Straight Through Process (STP).

public class RestClientSimple {
    private static final String BASE_URL = "http://localhost:8080/business-central/rest/";
    private static final String AUTH_URL = "http://localhost:8080/business-central/org.kie.workbench.KIEWebapp/j_security_check";
    private static final String DEPLOYMENT_ID = "customer:evaluation:1.0";
    private static final String PROCESS_DEF_ID = "customer.evaluation";
    private static String username = "erics";
    private static String password = "bpmsuite";
    private static AuthenticationType type = AuthenticationType.FORM_BASED;

    public static void main(String[] args) throws Exception {

     System.out.println("Starting process instance: " + DEPLOYMENT_ID);
     // start a process instance with no variables.

     System.out.println("Completed process instance: " + DEPLOYMENT_ID);

     * Start a process using the rest api start call, no map variables passed.
     * @throws Exception
   public static void startProcess() throws Exception {
        String newInstanceUrl = BASE_URL + "runtime/" + DEPLOYMENT_ID + "/process/" + PROCESS_DEF_ID + "/start";
        String dataFromService = getDataFromService(newInstanceUrl, "POST");


The basics here are the setup of the business central URL to point to the start RestAPI call. In the main method one finds a method call to startProcess() which builds the RestAPI URL and captures the data reply sent from JBoss BPM Suite.

To see the details of how that is accomplished, please refer to the class in its entirety within the JBoss BPM Suite and JBoss Fuse Integration Demo project.

Intermezzo on testing

An easy way to test your process once it has been built and deployed is to use curl to push a request to the process via the RestAPI. Such a request looks like the following, first in generic form and then a real run through the same Customer Evaluation project as used in the previous example.

The generic RestAPI call and proper authentication request is done in curl as follows:

$ curl -X POST -H 'Accept: application/json' -uerics 'http://localhost:8080/business-central/rest/runtime/customer:evaluation:1.1/process/customer.evaluation/start?map_par1=var1&map_par2=var2'

For the Customer Evaluation process a full cycle of using curl to call the start process, authenticating our user and receiving a response from JBoss BPM Suite should provide the following output.

$ curl -X POST -H 'Accept: application/json' -uerics 'http://localhost:8080/business-central/rest/runtime/customer:evaluation:1.1/process/customer.evaluation/start?map_employee=erics'

Enter host password for user 'erics':  bpmsuite1!


Results of our testing with curl.
We see the process instances complete in the process instance perspectives as shown.

Client application

The third and final way to start your JBoss BPM Suite process instances is more in line with injecting a bunch of pre-defined submissions to populate both the reporting history and could be based on historical data.

The example shown here is available in most demo projects we provide but is taken from the Mortgage Demo project.

This demo client is using static lines of data to be injected into the process one at a time. With a few minor adjustments one could pull in historical data from an existing data source and inject as many processes as desired in this format. It also is a nice way to stress test your process projects.

We will skip the setup of the session and process details as these have been shown above, but provide instead a link to the entire demo client class and leave these details for the reader to pursue.

Here we will just focus on how the individual start process calls will look.

public static void populateSamples(String userId, String password, String applicationContext, String deploymentId) {

   RuntimeEngine runtimeEngine = getRuntimeEngine( applicationContext, deploymentId, userId, password );
   KieSession kieSession = runtimeEngine.getKieSession();
   Map processVariables;

   //qualify with very low interest rate, great credit, non-jumbo loan
   processVariables = getProcessArgs( "Amy", "12301 Wilshire", 333224449, 100000, 500000, 100000, 30 );
   kieSession.startProcess( "", processVariables );


As you can see the last line is where the individual mortgage submission is pushed to JBoss BPM Suite. If you examine the rest of the class you will find multiple entries being started one after another.

We hope you now have a good understanding of the ways you can initiate a process and choose the one that best suits your project needs.

Wednesday, September 17, 2014

How to setup custom remote deployment repositories for JBoss BPM Suite

In this article we wanted to share another configuration property that can provide surprising help when setting up your JBoss BPM Suite.

Previously we outlined a basic set of configuration properties to provide you with a few tricks when installing your own JBoss BRMS or JBoss BPM Suite products.

As the JBoss BPM Suite is a super set, including full JBoss BRMS functionality, the rest of this article will refer only to JBoss BPM Suite but apply to both products.

In this article we will show you how to modify your JBoss EAP container configuration to point the products at a custom deployment repository by adjusting a single configuration property.

Maven repository

The default setup is that the products will look for your maven setting in the default settings.xml as found set in the M2_HOME variable or in the users home directory at .m2/settings.xml.

The following system property can be added to JBoss EAP standalone.xml configuration file to point to any file containing your custom settings.
  • kie.maven.settings.custom
    • Location of the maven configuration file where it can find it's settings.
    • Default: the M2_HOME/conf/settings.xml or users home directory .m2/settings.xml
It should also be mentioned that by taking control of the settings for your remote deployment repository you also now have control over the (remote) repositories from which you pull your dependencies. For example,  we can now point to repositories within your enterprise to provide JBoss BPM Suite with existing data models.

Example usage in JBoss EAP

When initially setting up the product for use on JBoss EAP containers, one can adjust configuration with the help of system properties.

Below we show how to configure an installation to point to our custom maven deployment repository by using a custom settings file we will call bpmsuite-settings.xml

<!-- Configuration property found in standalone.xml -->
<property name="kie.maven.settings.custom" value="${user.home}/.m2/bpmsuite-settings.xml" />

We hope this helps you with configuring your own custom deployment repositories and enables you to tie into existing continuous integration infrastructures that might exist in your organization.

Friday, September 12, 2014

Catch Up on East Coast Tour You Might Have Missed Last Week (Video)

Previously I mentioned that this week I would be on an East Coast tour with JBoss BRMS & BPM Suite.

It started at the Boston JUG where due to a mix up I ended up showing up about 40 mins late, but this did not deter this fine group of Javan's, who enjoyed pizza until the show could start. With a minimum of fuss we kicked it off and powered through more than an hour of JBoss based rules, events and BPM materials that they were able to take home and work through at their own pace.
Hands on labs available online

The materials are all available online as the labs are constructed to be hands on and easy to follow without assistance.

The sessions cover both local installations and provide the necessary information to get started on your very own xPaaS installation of bpmPaaS on OpenShift too.

What more could you want?

A few questions at the end and some great follow up discussions on the front steps of the building around ongoing projects and challenges that we brainstormed a bit on before heading home into the night.
Rules, events and BPM

The day after we were off to Washington DC where the DCJBug had invited us for this hands on rules, events and BPM session.

The venue was well located near the airport and after everyone arrived, enjoyed the pizza and got settled we kicked of roughly a 90 minute session that they captured on video.

Some of the attendees were remote across the US so it was played out live to all these locations and you can enjoy the session now too!

Fun was had by all and there was a lot of enthusiasm around the ability to get started from no knowledge of the technology and build something real by the end while learning about these products. The online hosted hands on labs are available for your pleasure at any time.


Monday, September 8, 2014

The Essential Steps to Run the BPM HR Employee Rewards Process

There is nothing like seeing the results of a good project come to the screen when you run it the first time.

This is also the case for those of you that have been following along with the online BPM workshop series that has been published here over the last few months.

With the final week and lab completed you are ready to build, deploy and run through the HR Employee Rewards process to see how it all looks.

In case you missed this series, we proved some of the links to get you started.

The first series of labs (1-10) focuses on JBoss BRMS and building rules, events, and ruleflow artifacts to launch your very own online retail Cool Store.

The second series of labs (11-17) puts you through the paces of creating an HR Employee Rewards process.

Series Table of Contents:

  1. The introduction and installation of JBoss BRMS 
  2. Creating a new project
  3. Creating a domain model
  4. Creating a Domain Specific Language (DSL)
  5. Creating Guided Rules
  6. Creating Technical Rules (DRL)
  7. Creating Guided Decision Tables
  8. Create RuleFlow Process
  9. Create Test Scenarios
  10. Running the Cool Store
  11. Installing JBoss BPM Suite
  12. Creating Rewards Project
  13. Create Domain Model
  14. Create Rewards Process
  15. Complete Process Details
  16. Creating User Task Forms
  17. Running Rewards Demo

Now that you have run through the results yourself in the final lab 17, we wanted to provide a link to a video run through of this project:

We hope you enjoy this video.

Friday, September 5, 2014

Red Hat JBoss BPM Suite - Online Workshop Building a Rewards Demo (Lab 17 Running Rewards Project)

We are back with this weeks episode in the JBoss Business Rules Management System (BRMS) & Business Process Management (BPM) Suite online workshop series.

In this workshop we will be introducing you to the possibilities that abound for your business when leveraging these two new and exciting products.

Each week we will push out the next installment of this workshop that will lead you through building an employee rewards approval application, leveraging a business process with human tasks.

This project will be available as a completed project called the Rewards Demo, but we thought it would be interesting to help you build this human resource application from scratch.

The second half of the workshop will be taking you through the same type of exercise, but with the JBoss BPM Suite, where you will put together an application that leverages a process, leverages human tasks, allows you to design your own forms, and much more.

Last week we created the necessary user task forms.
Running rewards project

This week we run our completed rewards project and examine the BAM dashboard reporting.

The weeks following will feed you a new set of exercises to help you to the next stage of development as you watch your very own BPM project march towards completion.

All of the workshop materials will be hosted online with the help of OpenShift, so all you need is a browser to follow along.

You do not need to be a Java developer, as this workshop focuses on only the online product web dashboard experience as an analyst would interact with the product. The only technical deviation from this will be the initial installation of the product, but we have detailed instructions and it is a three step process that should not take you more than a few minutes.

So what are you waiting for?

Get started running the rewards project:

If you missed previous episodes of this workshop, you can backtrack to catch up.

Series Table of Contents:
  1. The introduction and installation of JBoss BRMS 
  2. Creating a new project
  3. Creating a domain model
  4. Creating a Domain Specific Language (DSL)
  5. Creating Guided Rules
  6. Creating Technical Rules (DRL)
  7. Creating Guided Decision Tables
  8. Create RuleFlow Process
  9. Create Test Scenarios
  10. Running the Cool Store
  11. Installing JBoss BPM Suite
  12. Creating Rewards Project
  13. Create Domain Model
  14. Create Rewards Process
  15. Complete Process Details
  16. Creating User Task Forms
  17. Running Rewards Demo
Be sure to keep an eye out for next weeks release of the following article which will bring you a step closer to completing your very own BPM project.

Note: if for some reason the online materials are not available, feel free to contact me.

Thursday, September 4, 2014

A Night of Hands On Rules, Events and BPM with the Peru JUG

Yesterday evening in Peru timezone and middle of the wee hours of the morning for me here in Europe, we held a BPM workshop online for the Peru JUG.

The group set up a hangout and we talked rules, events and BPM tooling for around two hours. I took them through the following topics over the course of the event:

It was fun to interact with this group as they were full of questions around the strengths of the open source rules, events and BPM products. You can watch the recording if you missed it here:

This is the second continent where we have toured with our online BPM workshop series, next week we take it on the road on the east coast of North America.

If you would like to have this workshop series stop in at your local event, just let me know as I am happy to bring rules, events and BPM to your area.

Hope to see you soon!