KIE Execution Server :: Kick-off Example

 

Development Environment

Deploy KIE Server

  • I work with pc-1-jboss-kie-server, IP=192.168.195.101, see post My jBPM Network Environment Configuration using VMware Workstation.
  • Create user: ./add-user.sh -a -u kieserver -p kieserver1 -g admin,kie-server
  • Copy the file kie-server-6.5.0.Final-ee7.war into deployment folder and rename it to kie-server.war
  • Start WildFly: ./standalone.sh -c standalone-full.xml -Dorg.kie.server.id=hello-kie-server -Dorg.kie.server.location=http://192.168.195.101:8080/kie-server/services/rest/server
  • Access the endpoint: http://192.168.195.101:8080/kie-server/services/rest/server

Changing Datasource (PostgreSQL – optional; H2 – default)

module.xml:

  • Use the following:

    standalone.xml

standalone-full.xml

  • Start WildFly 10 with:

./standalone.sh -c standalone-full.xml -Dorg.kie.server.id=hello-kie-server -Dorg.kie.server.location=http://192.168.195.101:8080/kie-server/services/rest/server -Dorg.kie.server.persistence.dialect=org.hibernate.dialect.PostgreSQLDialect -Dorg.kie.server.persistence.ds=java:jboss/datasources/jbpmDS

After that you have:
The database schema is generated by Hibernate.

NEXUS Configuration

Nexus Repository Manager
Repositories:

Repositories group:

KJAR (KJAR Module), KContainer (KIE Container) Maven Project

pc-4-dev-1; IP=192.168.195.104

KJAR:
  • Standard JAR File
  • Contains:
    • Source files
    • Compiled classes and assets (rules, processes,…)
    • KBase and KSessions definitions – kmodule.xml
    • Module configuration and dependencies – pom.xml
  • Ready to deploy in a KContainer
kie maven plugin
The KIE plugin for Maven ensures that artifact resources are validated and pre-compiled, it is recommended that this is used at all times. To use the plugin simply add it to the build section of the Maven pom.xml and activate it by using packaging kjar.
<packaging>kjar</packaging>
<build>
<plugins>
<plugin>
<groupId>org.kie</groupId>
<artifactId>kie-maven-plugin</artifactId>
<version>6.5.0.Final</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
The plugin comes with support for all the Drools/jBPM knowledge resources. However, in case you are using specific KIE annotations in your Java classes, like for example @kie.api.Position, you will need to add compile time dependency on kie-api into your project. It is recommend to use the provided scope for all the additional KIE dependencies. That way the kjar stays as lightweight as possible, and not dependant on any particular KIE version.
Building a KIE module without the Maven plugin will copy all the resources, as is, into the resulting JAR. When that JAR is loaded by the runtime, it will attempt to build all the resources then. If there are compilation issues it will return a null KieContainer. It also pushes the compilation overhead to the runtime. In general this is not recommended, and the Maven plugin should always be used.
The Kick-off Example KJAR Project
Create maven project (KJAR):
Files in the project:

Maven settings.xml

kmodule.xml

pom.xml

 

After mvn deploy

KIE Server Maven Settings

Default settings.xml:

 

Deploy Container

Do

for createHelloContainer.xml:

if you already have a container:

After deploy you have hello-kie-server.xml in wildfly-10.0.0.Final/bin:

 

Delete Container

 

Leave a Reply