2018/12/11
Deploying jBPM Business Apps on Docker
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
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:
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.
Hope this demo helps you guys get some ideas on how to create cool jBPM business apps.
2018/12/09
Starting your jBPM Business Application as a Service
In addition to starting your jBPM Business Application generated via start.jbpm.org using the provided launch scripts, for example:
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:
./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):
sudo ln -s ~/business-application/business-application-service/target/
business-application-service-1.0.SNAPSHOT.jar
/etc/init.d/business-application-service-1.0.SNAPSHOT.jar
after this you can start your business app with for example:
service business-application-service-1.0.SNAPSHOT.jar start
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).
The script could look as follows:
[Unit]
Description=business-application-service-1.0.SNAPSHOT
After=syslog.target
[Service]
User=business-application-service-1.0.SNAPSHOT
ExecStart=~/business-application/business-application-service/target/
business-application-service-1.0.SNAPSHOT.jar
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
Don't forget to change the description, user and execstart parameters to match your installation.
Now we can tell systemd to start our business app on system boot with for example:
systemctl enable business-application-service-1.0.SNAPSHOT.service
2. Windows Service
You can start your business application as a Windows service using winsw command. For details on how to do this please read detailed instructions on https://github.com/snicoll/spring-boot-daemon.
3. OSX Service
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.
2018/12/06
Using Apache Kafka in your jBPM Business Application - Demo
Recently our jBPM community member Prasanth Nair was kind to contribute the Kafka workitem to our jBPM workitem repository. The contributed Kafka workitem includes a handler which uses the Kafka producer to send messages to a specified topic.
In this post we will show you a small demo using this Kafka workitem. As usual this demo is based on the jBPM business applications which you can easily generate on start.jbpm.org.
You can find the source of the demo and detailed descriptions on how to set it up and get it up and running on github.
The demo app uses a simple business process that retrieves current weather information from openweathermap.org and sends it to the Kafka workitem so that this info can be sent to a Kafka topic.
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.
Many thanks to Prasanth for his contribution!
In this post we will show you a small demo using this Kafka workitem. As usual this demo is based on the jBPM business applications which you can easily generate on start.jbpm.org.
You can find the source of the demo and detailed descriptions on how to set it up and get it up and running on github.
The demo app uses a simple business process that retrieves current weather information from openweathermap.org and sends it to the Kafka workitem so that this info can be sent to a Kafka topic.
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.
Many thanks to Prasanth for his contribution!
Subscribe to:
Posts (Atom)