2018/12/11

jBPM Business Applications have an out-of-the-box configurations to deploy them as docker containers. We have created the video below to show you how easy it is to do that. The video also shows some useful docker commands to run after you have deployed your jBPM Business app as docker container. Enjoy.

2018/12/10

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.

2018/12/09

In addition to starting your jBPM Business Application generated via start.jbpm.org using the provided launch scripts, for example:./launch.sh clean install for unix or launch.bat clean install for windows, you can also start and manage your business application as a service. This provides you with extra control of your app especially in production environments. Weather you are on Unix based system, Windows, or OSX the first step is to configure the business application to generate a fully executable jar. To do this locate your service module of your business app and modify its pom.xml to configure the spring-boot-maven-plugin as follows:

With this configuration building your business app will produce a fully executable jar.

Now let's see how we can start the business app as a service under different operating systems.

1. Unix/Linux Service

Here we have two options, using init.d or systemd .

a) To install our business app as an init.d service we need to create symlink to our executable jar, for example (using the default setup on start.jbpm.org):

b) To install our business app as a systemd service we need to create a script called business-application-service-1.0.SNAPSHOT.service in the on-service-1.0.SNAPS directory (again we assume the default business app setup, the actual name has to reflect the real app name you have created during app creation on start.jbpm.org).

If you are on OSX, you can use the launchctl command. To get started first we need to create our launch configuration under ~/Library/LaunchAgents directory. So let's create a launch config file called business-application-service-1.0.SNAPSHOT.plist which can look as follows (again, assuming the default generation settings):

With the launch config created log out with your current user and log back in. Your business application has been started and you can right away access it under locahost:8090 in your browser.

You can manage your business app service at this point using the launchctl command. For example to stop our business app service we would run:

launchctl stop business-application-service-1.0-SNAPSHOT

and to stop our business application from being started automatically on system startup/login we can simply remove our launch configuration .plist file from ~/Library/LaunchAgents directory.

Hope this information is useful to some of you guys when choosing options on how to launch/deploy/manage your jBPM Business Applications.

The business Spring Boot app uses the Spring-kafka integration and defines a Kafka consumer configuration as well as the Spring WebSocket support to setup a WebSocket config. Kafka messages that are consumed by our business app are then being broadcasted to a websocket endpoint and picked up by our UI (via sockjs and stomp). This way our UI can dynamically update the weather info display without any page refreshes needed.

Here is the definition of the demo business app Kafka consumer. Take a look at its consume method, which simply receives the Kafka message and sends it to a WebSocket endpoint, and here is the JavaScript setup which listens to the same WebSocket endpoint and updates the weather chart once new info is received.

Here is the demo walkthrough video where we explain the demo in detail, show the code, and run the demo.

Hope this demo gives you some ideas on how to create your own cool jBPM Business App using Apache Kafka.