JHipster generator for jBPM Business Apps

If you are a fan of JHipster you can now generate jBPM Business apps with it! We created a generator module for it which you can use as follows:

With Yarn:

yarn global add generator-jba

Or with NPM:

npm install -g generator-jba

Once installed generate your app with:

yo jba

and follow the questions. If you want to generate the app with default settings, run:

yo jba –quick=true

jBPM Visual Studio Extension – New version 0.6.0 adds jBPM Business Apps debugging

Happy to announce a new 0.6.0 version of the JBAVSC extension for Visual Studio Code.

This extension adds process debugging for your business apps!

Debugging business app process in Visual Studio Code

JBAVSC Github: https://github.com/BootstrapJBPM/jbavsc
Visual Studio Code Marketplace:  https://marketplace.visualstudio.com/items?itemName=tsurdilovic.jbavsc

Here is a youtube vide showing off all the features of this extension:

We can make this extension much much more powerful so if you are interested in helping please let us know!

Enabling CORS in your jBPM Business Application

Currently when you generate your jBPM Business Application (online via start.jbpm.org, command-line via the jba-cli package, or in Visual Studio code via the jBPM extension) your app will have CORS (Cross-origin resource sharing) disabled by default.

With CORS disabled, if you have a consumer app (e.g. React frontend)  which does not live on the same domain as your business app, it will not be able to query its REST api.

CORS will be enabled by default with the next jBPM community release (7.18.0.Final), see Jira JBPM-8176, but if you would like to enable this on you own now, it is very easy to do:

In your generated business app service module edit the DefaultWebSecurityConfig.java file and replace it with the one in this Gist. That’s it 🙂

With this change in place you will now be able to query your business apps REST api from any domain, for example if you are using jQuery.ajax and want to get your server information (/rest/server endpoint) you could do for example:

Sample ajax request to /rest/server

Visual Studio Code extension for generating jBPM Business Apps

If you are developing your apps using Visual Studio Code you can now install a new jBPM Business Application extension. With this extension and the great tooling support of VSC you can now generate, develop, and launch your jBPM business apps without ever leaving your development environment.

Here is the youtube video showcasing how to install and use this extension:

The sources of the extension are on github. We are looking for contributions to make this extension better in the future.

Generate jBPM Business Apps with Node.js Command-line interface (CLI)

In addition to start.jbpm.org there is now an command-line way to generate your jBPM Business Applications, namely with the jba-cli Node package.

jba-cli package on npmjs.com
Sample CLI usage
If you have Node installed locally you can install and run this package with:
npm install jba-cli -g
jba gen
This allows your to build your jBPM Business app zip file without having to go through the browser. 
To contribute to this little cool project feel free to clone it and create pull requests from its github repo.
Here is youtube video showing how to install and use the jba-cli command line interface to generate your app:

Using React as frontend for jBPM Business Apps

React is a very popular and powerful JavaScript framework and is currently one of the best frontend development frameworks out there.

In this demo we show how you can easily integrate React into your existing or new jBPM Business Application and consume data from the the out-of-the-box Rest services via React components.

React Demo 

As usual all the sources of this demo are on GitHub.
The demo integrates the React front-end app with the service module of your jBPM Business application via the frontend-maven-plugin and then bundles its resources in the generated business app jar. This way you can just start your business app with the provided launch scripts and both React frontend and your business app backend will be available and started together.

When building the demo the same plugin will also attempt to install node and npm (which are needed for React apps) if they are not available on your machine. It will also build the React frontend for you, so no need to build it separately.

Here is the youtube video for this demo:

Feel free to leave us any comments about this demo and ideas on how to improve it or what you would like to see next.

Building jBPM Business Applications with Gradle


By default jBPM Business Applications generated via start.jbpm.org are build with Apache Maven. Your generated apps also include build scripts (for Unix, OSX, and Windows) which you can use out of the box to build all the apps modules, as well as launch your app in normal or dev modes.

Using Maven is fine however it excludes Gradle users from being able to build and launch jBPM Business Applications using their favorite build tool.

If you are using Gradle, take a look at this GitHub repo which includes Gradle build files as well as build scripts that call Gradle to build and launch your business application.

Follow the documentation there to set up your Gradle build environment for your generated jBPM business app.

Note that the out-of-the-box Maven build scripts are still the preferred choice when building your app. This is because the limitation of the Gradle scripts not being able to deploy your app on Docker and Openshift. We use the fabric8 plugin to help us do that and this plugin is not currently available for Gradle unfortunately (you can get more info on that here).

Also to note we are not Gradle experts and it would be really helpful if our jBPM community could help us with making the Gradle build for jBPM Business Applications better. If you are interested please clone https://github.com/tsurdilo/jbpm-business-apps-gradle and submit changes via git pull requests and share it to our community. We would really appreciate that!!

jBPM Business Apps and Okta Single Sign-on (SSO)

Wanted to showcase a new jBPM Business Applications demo that includes easy
integration with the Okta identity management service.

The demo uses the developer.okta.com setup and the Okta Spring boot starter to quickly set up SSO for our jBPM Business App. It also shows how easy it is to restrict access to certain pages of your jBPM Business Application using the authentication info and identity setup in Okta.

Demo source code is on github.

The demo requires you to make an account on developer.okta.com (its free) and create an Okta application and set up two group called “Admin” and “Sales”

Okta group setup

Only other configuration is in the your apps application.properties file:

application.properties setup

All of this information you get for free once you create an account and an application on the Okta developer site.

Once you have completed this setup and start the Okta demo app, go to localhost:8090 and to authenticate and access your app. Note that since there is no logout feature in the demo app, in order to simulate the logout simply delete your recent browser cookies.
If you don’t create and set up the “Sales” group in Okta for your application there accessing localhost:8090/sales will give you a “403” page:
Demo app 403 page

Otherwise you will be able to access it:

Demo sales page

The apps index page is authorized to users that are in the “Admin” group that you have set up in Okta.

Here is a youtube video which walks you through the Okta demo and shows how simple it is to set 
this all up:

jBPM Business Applications Demo – Process terminal using Spring Shell

So far our jBPM Business Applications demos have involved some sort of web-based UI for interacting with our business processes. Sometimes a web-ui is not needed and working with processes via an interactive terminal is the best way to get this done.

In this demo we show how to use Spring Shell inside your jBPM Business Application created via start.jbpm.org. Here is a quick screenshot of the demo application:

Demo schreenshot

We start our demo app as usual using the already provided launch scripts but once it starts we do not launch our browser and go to localhost:8090 (default) to access it, but instead we are presented with a prompt and can start typing in our commands to interact with our business processes.

Spring Shell provides some very useful commands out of the box, such as “help”, “clear”, “exit”, “history”, and “stacktrace”. Our demo app defined ontop of that our own custom commands to interact with our business processes. 
Commands that we define in our business app demo are:
  • deploy <groupId> <artifactId> <version>
  • processdefs
  • processinstances
  • startprocess <processDefId> <deploymentId>
Our deploy command allows us to deploy a kjar module which is available in our local maven repository. The demo app comes with one such module which you can use to deploy after the application has started with the command:
The processdefs command simply shows all currently available process definition (across all deployments):
The startprocess command allows you to start a business process. It takes in the process definition id and the deployment unit id (if deployment unit id is not specified, the default one is assumed). So for example to start our “firstTestProcess” business process we can do:

Lastly, the processinstances command shows all process instances that are available, for example:

Finally here is a youtube video where we run the demo and show off all the commands. The video also explains the code and how to create custom commands using Spring Boot and Spring Shell.

(This is the first time I tried creating a youtube video intro so please don’t laugh ….too much 🙂 )

Hope this demo helps you guys get some ideas on how to create cool jBPM business apps.