2018/10/30

Business Process Driven Web Terminal - jBPM Business Apps Demo

In this jBPM Business Application demo we show how you can dynamically present your business process data to your users.


Demo sample


The demo app is a Websocket terminal app where you can enter in different commands and results of those commands are displayed back. Each command entered triggers our demo business process which uses the jBPM Business Rules task to evaluate the command and then passes it on to
the jBPM Exec workitem (or the OpenWeatherMap workitem if weather info is requested).


Business process used in demo

The demo shows off how results of business process execution can dynamically trigger updates of your app UI. It also shows the power of the jBPM Exec workitem which can come really handy in my business app situations.

For more details and a walkthrough of this demo app view the youtube video here:




2018/10/15

Launch of Business Applications

The time has come - Business Applications are here!!!


It's a great pleasure to announce that the Business Applications are now officially launched and ready for you to get started.

start.jbpm.org

Business application can be defined as an automated solution, built with selected frameworks and capabilities that implements business functions and/or business problems. Capabilities can be (among others):
  • persistence
  • messaging
  • transactions
  • business processes, 
  • business rules
  • planning solutions
Capabilities essentially define the features that your business application will be equipped with. Available options are:
  • Business automation covers features for process management, case management, decision management and optimisation. These will be by default configured in the service project of your business application. Although you can turn them off via configuration.
  • Decision management covers mainly decision and rules related features (backed by Drools project)
  • Business optimisation covers planning problems and solutions related features (backed by OptaPlanner project)

Business application is more of a logical grouping of individual services that represent certain business capabilities. Usually they are deployed separately and can also be versioned individually. Overall goal is that the complete business application will allow particular domain to achieve their business goals e.g. order management, accommodation management, etc.

Business application consists of various project types
  • data model - basic maven/jar project to keep the data structures
  • business assets - kjar project that can be easily imported into workbench for development
  • service - service project that will include chosen capabilities with all bits configured
Read more about business applications here


Get started now!

To get started with your first business application, just go to start.jbpm.org and generate your business application. This will provide you with a zip file that will consists of (selected) projects ready to run.

Once you have the application up and running have a look at documentation that provides detailed description about business applications and various options in terms of configuration and development.

Make sure to not miss the tutorials that are included in the official documentation... these are being constantly updated so more and more guides are on the way. Each release will introduce at least 2 new tutorials ... so stay tuned.



Samples and more

business-applications samples
Business application launch cannot be done without quite few examples that can give you some ideas on how to get going, to name just few (and again more are coming)
  • Driver pickup with IFTTT 
  • Dashboard app with Thymeleaf
  • IT Orders with tracking service built with Vert.x
  • Riot League of Legends
This business application GitHub organisation includes also source code for tutorials so make sure you visit it (and stay around for a bit as more will come).



Call for contribution and feedback

Last but not least, we would like to call out for contribution and feedback. Please give this approach a go and let us know what you think, what we could improve or share the ideas for business application you might have.

Reach out to us via standard channels such as mailing lists or IRC channel.

2018/10/12

jBPM Business Applications + IFTTT = Control everything!

Here is another jBPM Business Application demo which uses the IFTTT workitem handler to connect your business processes in your business applications with the IFTTT Service.

In this demo we present users with a simple form where they can enter in their info and the location where they are in order for someone to come pick them up:


Once the form is submitted our business process is started which passes this information to the IFTTT workitem handler that then calls an Applet on the IFTTT platform:


This applet takes in the address entered by our user and launches Google Maps on our phone showing us the directions where the user is and also sends us an SMS message showing this information as well.



The demo also shows how we can start a business process in your business application in HTML via the kie-server thymeleaf dialect.

The source code of the demo can be downloaded here.

Here is also a video with a walkthrough of this demo. Watch the whole video or skip to the end to see the demo actually working ;)



With the jBPM IFTTT Workitem you can do some really powerful things, connect your business processes with different devices for example. Hope this demo gives you some ideas on creating your own cool apps with jBPM Business Applications.

2018/10/11

Handle service exceptions via subprocess

Interacting with services as part of your business process (or in more general business automation) is a common requirement. Though we all know that services tend to fail from time to time and business automation solutions should be able to cope with that. A worth reading article was recently published by Donato Marrazzo and can be found here Reducing data inconsistencies with Red Hat Process Automation Manager

Described feature in this article was actually inspired by discussion with Donato so all credit goes to him!

BPMN2 has already a construct for similar thing - error boundary events that can be easily attached to service tasks to deal with exceptions and perform additional processing or decision taking. This approach has some drawbacks in more advanced scenarios

  • error handling needs to be done on individual task level
  • retry of the same service call needs to be done via process modelling - usually a loop
  • each error type needs to be handled separately and by that makes the process definition too verbose

The first point from the above list can be addressed by using even based subprocess that starts with error event but that still suffers from the two other points.

To address this an additional error handling is introduced (in jBPM version 7.13) that allows the work item handlers (that implement the logic responsible for service interaction) to throw special type of exception org.kie.api.runtime.process.ProcessWorkItemHandlerException

This exception requires three parameters
  • process id that should be created to deal with this exception
  • selected handling strategy to be applied when exception handling process is completed
  • root cause exception
When such exception is thrown from work item handler it triggers automatic error handling by starting subprocess instance with the definition identified by process id set on the exception. If the process is straight through (meaning does not have any wait states) service task that failed will apply the handling strategy directly, otherwise it puts the service task in a wait state until the subprocess instance is completed. Then the strategy is applied on the service task.

Supported strategies

There are four predefined strategies 
  • COMPLETE - it completes the service task with the variables from the completed subprocess instance - these variables will be given to the service task as output of the service interaction and thus mapped to main process instance variables
  • ABORT - it aborts the service task and moves on the process without setting any variables
  • RETRY - it retries the service task logic (calls the work item handler again) with variables from both the original service task parameters and the variables from subprocess instance - variables from subprocess instance overrides any variables of the same name
  • RETHROW - it simply throws the error back to the caller - this strategy should not be used with wait state subprocesses as it will simply rollback the transaction and thus the completion of the subprocess instance
With this feature service implementors (those who implement work item handlers) can simply decide how the exception should be handled and what strategy it should apply to the failing service tasks once the error was evaluated and fixed.

Out of the box handlers and exception handling

Three major out of the box work item handlers are equipped with this handling automatically as soon as they are created with process id to handle exception and strategy. This takes over the regular error handling that will be applied when RETHROW strategy is selected.

  • RESTWorkItemHandler
  • WebServiceWorkItemHandler
  • EmailWorkItemHandler

Sample registration for RESTWorkItemHandler via deployment descriptor would be

new org.jbpm.process.workitem.rest.RESTWorkItemHandler("username", "password", classLoader, "handlingProcessId", "handlingStrategy")

Look at available constructors of given handler class to see all possible options. Similar way email and Webservice handlers can be configured to handle the exceptions via subprocess.

Use cases

Here are few examples that could be implemented
  • report to administrator that service task failed - this would have to be via subprocess that has user task assigned to administrators 
  • use a timer based sub process to introduce some delay in retries
  • ask business users to provide the information in case system is down in time critical situations 
There can be many more use cases implemented by that and one of the most important things with this is it does not have to be modelled for each and every task that could fail. It is up to the service handler to instruct what and how should be done in case of errors.

In action...

A short screencast showing this in action, simple process with custom service task that has a work item handler that throws ProcessWorkItemHandlerException exception and starts user focused subprocess to provide expected values and then apply COMPLETE strategy.



Here is the complete sample repository shown in the above screencast.

Hopefully you will find this useful and that will allow you to better automate your business to avoid any repetitive actions ...

Visit jbpm.org to download latest version of the jBPM project

2018/10/09

jBPM Business Apps - dashboard demo



This is first part of the "What do after I generate my business app?" series where we show demos that are supposed to give you ideas on how to get started on your own to build really cool business apps.

In this demo we very quickly (seriously less than 20 lines of code) create a dashboard through which we can interact with business processes in our business app. You can follow the steps shown in the video below and get this up and running. 

Here are the links:

* Youtube Video:



* Kie Server Dialect project used in the video (note this location may change soon so look there for a link to the projects new home once its moved).

Happy jBPM Business App coding

Let's embed forms ... rendered by KIE Server

jBPM comes with rather sophisticated form modeller that allows to graphically build forms for processes and tasks. These forms can then be used to interact with process engine to start new instances or complete user tasks.

One of the biggest advantages of using forms built in workbench is that they share the same life cycle as your business assets (processes and user tasks). By that they are versioned exactly the same way - so if you have another version of a process that requires more information to start you simply create new version of the project and make changes to both process definition and form. Once deployed you can start different versions of the process using dedicated forms.

Although to be able to take advantage of these forms users have to be logged into workbench as the only way to render the content is ... through workbench itself. These days are now over ... KIE Server provides pluggable renderers for forms created in workbench. That means you can solely interact with kie server to perform all the needed operations. So what does this brings:
  • renders process forms - used to start new instances
  • renders case forms - used to start new case instances - includes both data and role assignments
  • renders user task forms - used to interact with user tasks - includes life cycle operations

Worth noting is that rendered forms are fully operational, meaning they come with buttons to perform all the operations that are based on the context - e.g. if user task is in in progress state there are buttons to stop, release, save and complete.

Here are few screenshots on how the forms look like, these are taken from the sample projects that come out of the box with jBPM distribution



Evaluation start process form

Mortgage start process form



IT Orders start case form
As it was mentioned, form renderers are pluggable and out of the box there are two implementations

  • based on PatternFly - this is the default renderer that keeps the look and feel consistent with workbench
  • based on Bootstrap
Renderers can be switched per each form rendering request by simply appending query parameter
?renderer=patternfly or ?renderer=boostrap if not given patternfly is the default one.

Here are few examples of the REST endpoints that illustrate how to get these forms rendered

http://localhost:8080/kie-server/services/rest/server/containers/evaluation/forms/processes/evaluation/content
http://localhost:8080/kie-server/services/rest/server/containers/evaluation/forms/tasks/1/content


http://localhost:8080/kie-server/services/rest/server/containers/mortgage-process/forms/processes/Mortgage_Process.MortgageApprovalProcess/content
http://localhost:8080/kie-server/services/rest/server/containers/mortgage-process/forms/tasks/2/content


http://localhost:8080/kie-server/services/rest/server/containers/itorders/forms/cases/itorders.orderhardware/content
http://localhost:8080/kie-server/services/rest/server/containers/itorders/forms/tasks/3/content

Note that containers are given as alias so that brings in additional benefits when working with forms and multiple project versions.

And at the end few short screen casts showing this feature in action

Evaluation process


Mortgage process


IT Orders case


Multi Sub Form - dealing with list of items in forms



More technical information will be provided in the next article as this one is just a quick preview of what's coming. Hope you like it and don't forget to provide feedback!