https://github.com/kmacedovarela/advanced-bpmn2-process
This is an example of bpmn2 process implementation with Red Hat BPMS 6.4 showing the use of KIE Server, Rest KIE Server API, compensation, notification, task reassignment, time cycle, REST WIH consuming two ws that run on WildFly Swarm.
https://github.com/kmacedovarela/advanced-bpmn2-process
Last synced: 4 months ago
JSON representation
This is an example of bpmn2 process implementation with Red Hat BPMS 6.4 showing the use of KIE Server, Rest KIE Server API, compensation, notification, task reassignment, time cycle, REST WIH consuming two ws that run on WildFly Swarm.
- Host: GitHub
- URL: https://github.com/kmacedovarela/advanced-bpmn2-process
- Owner: kmacedovarela
- Created: 2017-07-19T18:31:00.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-09T12:40:23.000Z (about 8 years ago)
- Last Synced: 2025-04-06T15:36:29.437Z (7 months ago)
- Language: FreeMarker
- Size: 4.24 MB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Solar Village
## Red Hat BPM Suite Advanced Process Features Usage ExampleThis is an example of bpmn2 process implementation with Red Hat BPMS 6.4 showing the use of KIE Server (and it's Rest API), human tasks, tasks compensation, notification and task reassignment, time cycle and REST WIH (consuming two services that runs on WildFly Swarm).
Basically:
* Process for a new order approval
* Need for a human to approve or deny a request
* Parallel creation via REST of two permits (persisted data)
* Status check every 10s via REST
* If approved, process ends
* If denied, rollback of persisted data (in other application) occursProcess image is at the end of this README.
If you need further details feel free to contact me.
## 1. Pre reqs
* [Red Hat BPM Suite 6.4 ](https://access.redhat.com/jbossnetwork/restricted/softwareDetail.html?softwareId=48471&product=bpm.suite&version=&downloadType=distributions)
* Maven
* Java >7
* [Fake SMTP](https://github.com/kmacedovarela/advanced-bpmn2-process/blob/master/extra/fake-smtp.jar) (If you don't have any smtp server for a demo, this could fit)
* WS Permits## 2. Install #TLDR
* Install and configure BPMS and Kie Server
* Clone this [repo](https://github.com/kmacedovarela/advanced-bpmn2-process.git)
* Create and start kie server container (Per Process Instance Runtime Strategy)
* Start [WS Project](https://github.com/kmacedovarela/ws-permits) and [SMTP Server](https://github.com/kmacedovarela/advanced-bpmn2-process/blob/master/extra/fake-smtp.jar)
* Test process using Kie Server REST API (Examples in topic 3)## 3. Usage
* If you use the container name with the same name of the project GAV, (i.e. `com.kvarela:sv-process:1.0`) you will be able to see in Business Central, all the process instances and tasks created created by Kie Server.### Kie Server REST API:
* Obs. Headers to use with POST and PUT (Auth required, you can use i.e. `bpms` user):
`Accept:application/json
Content-Type:application/json`* Start process:
```
POST http://localhost:8081/kie-server/services/rest/server/containers/com.kvarela:sv-process:1.0/processes/sv-process.newOrderPermitting/instances
{
"newOrder" :{
"com.kvarela.NewOrder": {
"address":"My Street Demo" ,
"hoaApproval": "",
"hoaMeetingDate": "2017-07-30",
"salesman": "salesman"
}
}
}
```* List available tasks for potential owner (user `salesman`) :
`PUT http://localhost:8081/kie-server/services/rest/server/queries/tasks/instances/pot-owners?user=salesman`* Claim task 1 for user `salesman`
`PUT http://localhost:8081/kie-server/services/rest/server/containers/com.kvarela:sv-process:1.0/tasks/1/states/claimed?user=salesman`* Start task 1 for user `salesman`
`PUT http://localhost:8081/kie-server/services/rest/server/containers/com.kvarela:sv-process:1.0/tasks/1/states/started?user=salesman`* Complete task 1 for user `salesman` with aproval
```
PUT http://localhost:8081/kie-server/services/rest/server/containers/com.kvarela:sv-process:1.0/tasks/1/states/started?user=salesman
{
"outHoaApproval": "true"
}
```## 4. Installation, configuration and running (with details)
### 1.1 Configure Red Hat BPM Suite
#### 1.1.1 Configure EAP
* Add the Java Options in $JBOSS_HOME/bin/standalone.conf (Automatic marshaling for custom POJO and bypass user security)
```
JAVA_OPTS="$JAVA_OPTS -Dorg.kie.server.bypass.auth.user=true -Dorg.drools.server.filter.classes=true"
```* Add the system properties (Configures BPMS & Kie Server)
```
```
* Configure the EAP SMTP Subsystem (For notification feature)```
$ $JBOSS_HOME/jboss-cli.sh -c --controller=127.0.0.1:9990
[standalone@127.0.0.1:9990] /system-property=org.kie.mail.session:add(value="java:jboss/mail/
Default")
[standalone@127.0.0.1:9990] /subsystem=mail/mail-session=default:write-attribute(name=from, value=bpms@acme.org)
[standalone@127.0.0.1:9990] /subsystem=mail/mail-session=default/server=smtp:write-attribute(name=username,value=admin)
[standalone@127.0.0.1:9990] /subsystem=mail/mail-session=default/server=smtp:write-attribute(name=password,value=password)
[standalone@127.0.0.1:9990] /socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=mail-smtp:write-attribute(name=host,value=localhost)
[standalone@127.0.0.1:9990] /socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=mail-smtp:write-attribute(name=port,value=2525)
[standalone@127.0.0.1:9990] exit
```* Add users to JBoss EAP (Will be used by BPMS)
```
$JBOSS_HOME/bin/add-user.sh -a -u kieserver -p redhat@123 -g kie-server,rest-all
$JBOSS_HOME/bin/add-user.sh -a -u salesman -p redhat@123 -g salesman=sales,kie-server,rest-all,rest-task,rest-query
$JBOSS_HOME/bin/add-user.sh -a -u executive -p redhat@123 -g executive=executives,user,kie-server,rest-task,rest-query,agent
$JBOSS_HOME/bin/add-user.sh -a -u Administrator -p redhat@123 -g executive=admin,rest-all,PowerUser,Administrators,kie-server
$JBOSS_HOME/bin/add-user.sh -a -u bpms -p redhat@123 -g admin,sales,executives,user,kie-server,rest-task,rest-query,agent```
* Configure e-mail for these users. Add the lines below to `userinfo.properties` inside Business Central war. (By default, BPMS looks into this file).
```
$ vim $JBOSS_HOME/standalone/deployments/business-central.war/WEB-INF/classes/userinfo.propertiesadmin=admin@domain.com:en-UK:admin
salesman=saleman@acme.com:en-UK:salesman:[sales]
executive=executive@acme.com:en-UK:executive:[executives]
bpms=bpms@acme.com:en-UK:bpms:[executives,sales]
Administrator=admin@acme.com:en-UK:Administrator:[executives,sales]
sales=:en-UK:sales:[salesman,bpms,Administrator]
executives=:en-UK:executives:[executive,bpms,Administrator]
Administrators=:en-UK:Administrators:[Administrator]
```### 1.1.2. Importing the project into JBoss BPM Suite
* Start BPM Suite EAP:
`$JBOSS_HOME/bin/standalone.sh -Djboss.socket.binding.port-offset=1`
* Login in Business Central
* URL: http://localhost:8081/business-central
* User: bpms
* Password: redhat@123* Via Business Central:
* Create an organizational unit
* Clone this repository `https://github.com/kmacedovarela/advanced-bpmn2-process.git`
* Access project authoring tab
* Build and deploy project `sv-model`
* Build and deploy project `sv-process`#### 1.1.3. Creating Kie Server Container
* Access Tab `Deploy`, option `Execution Servers`
* Click on `Add Container`
* Select the project `sv-process`, and use the name `com.kvarela:sv-process:1.0`
* Click `next`
* Change the runtime strategy to `Per Process Instance`### 1.2. WS Project
#### 1.2.1. Prepare the WS project
* Download and prepare [WS Permits REST API](https://github.com/kmacedovarela/ws-permits/)
### 1.2.2. Start the webservices project
* Start the [WS Permits REST API](https://github.com/kmacedovarela/ws-permits/) that will be consumed by the process instances. Inside the project folder, run:
`mvn wildfly-swarm:run`## 1.3. Start your SMTP
* In case of Fake SMTP you can use `$ java -jar fake-smtp.jar`
## Enjoy
