+ All Categories
Home > Technology > Drools & jBPM Workshop Barcelona 2013

Drools & jBPM Workshop Barcelona 2013

Date post: 05-Dec-2014
Category:
Upload: salaboy-salaboy
View: 4,138 times
Download: 5 times
Share this document with a friend
Description:
for more information visit: http://salaboy.com
50
Drools & jBPM Workshop 2013 Diciembre · Barcelona Pere Fernandez · Walter Medvedeo · Mauricio Salatino
Transcript
Page 1: Drools & jBPM Workshop  Barcelona 2013

Drools & jBPMWorkshop 2013Diciembre · Barcelona

Pere Fernandez · Walter Medvedeo · Mauricio Salatino

Page 2: Drools & jBPM Workshop  Barcelona 2013

Agenda

● Drools & jBPM introduction● New Technology Stack● Tooling ● Installation & Configuration● Workshop● Q&A

Page 3: Drools & jBPM Workshop  Barcelona 2013

Short Disclaimer

The tooling that we will be showing is a SNAPSHOT/Nightly build version of the project master branch. It can be built downloading the

community projects hosted in github.com/droolsjbpm.

If you are using Windows (Internet Explorer), you can expect some issues that are still being fixed for

the next release.

Page 4: Drools & jBPM Workshop  Barcelona 2013

What is jBPM?

● jBPM is a flexible Business Process Engine● It allows us to define, execute and monitor

Business Processes● The core is flexible to support any process

definition language, but BPMN2 is the default one.

● We can embed jBPM in our applications or● We can use it as a service

Page 5: Drools & jBPM Workshop  Barcelona 2013

jBPM Example

Hiring a new Developer Example

Page 6: Drools & jBPM Workshop  Barcelona 2013

Advantages of using a Process Engine

● The processes says what to do and not how to do it (declarative nature). They can be used to discuss with non technical people how the company works.

● The processes can be used to teach new people about the companies procedures.

● All the process instances will log their activities and the process data that can be used to show in real time the company performance

● Making changes to processes are way faster than changing all the application code

● The development of the processes and the application infrastructure can be decoupled

Page 7: Drools & jBPM Workshop  Barcelona 2013

What is Drools?

● Drools is a Business Rule Engine● We can define declaratively how to react to

different scenarios● The main idea behind using a Rule Engine is to

decouple the business decision and behavior from the application code

● Rules are composed by:○ A set of conditions○ A set of actions

Page 8: Drools & jBPM Workshop  Barcelona 2013

Drools Example

○ One Rule ExampleRule “5% discount to silver customers”

when

$c: Customer( type == ‘silver’ )

$p: Purchase( customer == $c )

then

$p.setDiscount(“0.05”);

end

Page 9: Drools & jBPM Workshop  Barcelona 2013

Advantages of using a Rule Engine

● The rules says what to do and not how to do it (declarative nature). They can be used to discuss with non technical people how the company works.

● The rules can be used to teach new people about the companies decisions and policies.

● All the rules execution will log their activities data that can be used to show in real time the company performance

● Making changes to rules are way faster than changing all the application code

● The development of the rules and the application infrastructure can be decoupled

Page 10: Drools & jBPM Workshop  Barcelona 2013

Drools + jBPM == Platform (KIE)

● Processes gives us a way to formalize and automate business knowledge

● Rules gives us another way to formalize and automate business knowledge

● KIE Platform= Knowledge is Everything○ A platform to formalize, execute and monitor business

knowledge

Page 11: Drools & jBPM Workshop  Barcelona 2013

KIE Platform - New Things

● KIE Projects○ Provides the Drools and jBPM projects structure ○ Maven based / standard project structure○ Integrated with CDI○ Defines a Deployment Units for jBPM

● Whole new Tooling!● Inside the platform you can also find:

○ Drools Fusion for Complex Event Processing○ Drools Chance for Fuzzy Logic○ Drools Scorecards○ + Community Driven collaborations

Page 13: Drools & jBPM Workshop  Barcelona 2013

● Structure (Maven Standard + kmodule.xml)

KIE Project

Resources / Knowledge Assets

KIE Module Descriptor

Standard pom.xml File

Business Process

Forms

Page 14: Drools & jBPM Workshop  Barcelona 2013

KModule

● Convention Driven

● Or you can add custom configurations

Page 15: Drools & jBPM Workshop  Barcelona 2013

Whole new Tooling!!!!

Page 16: Drools & jBPM Workshop  Barcelona 2013

KIE Workbench - Technology Stack

Page 17: Drools & jBPM Workshop  Barcelona 2013

Tooling Tour

● Home● Authoring Perspective

○ Repository Management○ Modelling data○ Modelling a process○ Modelling forms

● Building & Deploying a Project● Starting a Process Instance● Task Management● Business Activity Monitoring

Page 18: Drools & jBPM Workshop  Barcelona 2013

Home

● The Knowledge Lifecycle○ Authoring○ Runtime Configurations○ Process Management○ Task Management○ Business Activity Monitoring

Page 19: Drools & jBPM Workshop  Barcelona 2013

Authoring Perspective - Administration

● Manage Organization Units● Creating new repository● Cloning existing repos

○ https://github.com/droolsjbpm/jbpm-playground● Removing existing repositories

Page 20: Drools & jBPM Workshop  Barcelona 2013

Authoring Perspective - Assets● Navigate through Organization Units, KIE

Projects…● Creating new KIE Projects● Creating Knowledge Assets

Page 21: Drools & jBPM Workshop  Barcelona 2013

Data Modeler (Tools > Data Modeler)● Create Data Objects● Add properties to Data Objects (Simple types or

other Data Objects)● Data Objects will be stored as Java files● Use them as Java Objects on runtime

Page 22: Drools & jBPM Workshop  Barcelona 2013

Process Designer (New Item > Business Process)● Based on BPMN 2.0● Context Menu for easy creation of flows● Visual validation● Simulation of business process

Page 23: Drools & jBPM Workshop  Barcelona 2013

Form Modeler (New Item > Form)

● Configure Form data sources○ Data Modeler Objects○ Java Class in classpath○ Simple types (String, Long, Integer, Date…)

● Add fields to Form○ By source○ WYSIWYG palette

● Configure fields properties (label, required…) ● Configure Form UI

○ Move fields○ Edit form HTML

Page 24: Drools & jBPM Workshop  Barcelona 2013

Form Modeler (II)

Page 25: Drools & jBPM Workshop  Barcelona 2013

Building & Deploying a Project● Project Editor

○ Project Dependencies○ Build & Deploy○ Deployment Perspective

Page 26: Drools & jBPM Workshop  Barcelona 2013

What happens when we Build & Deploy a Project?

Page 27: Drools & jBPM Workshop  Barcelona 2013

Process Management

● Process Definitions○ Shows only Deployed Process Definitions○ Create new Process Instances

● Process Instances○ You can inspect the details of your process instance○ You can look into the Process Variables (simple types

for now)

Page 28: Drools & jBPM Workshop  Barcelona 2013

Task Management

● Task Lists○ Work in your assigned tasks

■ Group Tasks■ Personal Tasks

● Task Forms○ FTLs -> Freemarker templates○ Forms -> Graphically Designed Forms using Form

Modeller

Page 29: Drools & jBPM Workshop  Barcelona 2013

Business Activity Monitoring● Dashboard

○ Generic Business Dashboard○ Business Process Dashboard○ Task Dashboard

Page 30: Drools & jBPM Workshop  Barcelona 2013

kie-wb installation and configuration

kie-wb distributions:● kie-wb-distributions:

https://github.com/droolsjbpm/kie-wb-distributions/ $ mvn clean install -Dfull

kie-wb-6.1.0-SNAPSHOT-eap-6_1.war

kie-wb-6.1.0-SNAPSHOT-jboss-as7.war

kie-wb-6.1.0-SNAPSHOT-tomcat7.war

● jbpm-dashboard:https://github.com/droolsjbpm/jbpm-dashboard$ mvn clean install -Dfull

jbpm-dashbuilder-6.1.0-SNAPSHOT-jboss-as7.war

jbpm-dashbuilder-6.1.0-SNAPSHOT-tomcat-7.war

Page 31: Drools & jBPM Workshop  Barcelona 2013

kie-wb installation and configuration

Download Wildfly server:

● Wildfly 8.0.0.Beta1 can be downloaded from:http://wildfly.org/downloads/

● Jboss AS 7.1.1 can still be downloaded from:http://www.jboss.org/jbossas/downloads/

Page 32: Drools & jBPM Workshop  Barcelona 2013

kie-wb installation and configuration

Install Wildfly server:

● Unzip the jboss-as-7.1.1.Final.zip file to a given directory <installation_dir>. $ unzip jboss-as-7.1.1.Final.zip

● Start servercd <installation_dir>/jboss-as-7.1.1.Final/bin

$ ./standalone.sh

note: For Windows systems it's recommended to avoid directories with blank spaces, or too long directories.

Page 33: Drools & jBPM Workshop  Barcelona 2013

kie-wb installation and configuration

Users creation:

● Create the server administrator user using the “add-user.sh” script.cd <installation_dir>/jboss-as-7.1.1.Final/bin

$ ./add-user.sh

● Check server installationhttp://localhost:9990/console/App.html

note: to create kie-wb application users and roles for development server, the user.properties and roles .properties files can be manually edited.

Page 34: Drools & jBPM Workshop  Barcelona 2013

kie-wb installation and configurationSecurity domain configuration:

● By default kie-wb application is configured to use the “other” security domain.

● Set this configuration in the standalone-full.xml file.

<security-domain name=" other" cache-type="default">

<authentication>

<login-module code=" UsersRoles" flag="required">

<module-option name="usersProperties"

value="${jboss.server.config.dir}/ bpms-users.properties"/>

<module-option name="rolesProperties"

value="${jboss.server.config.dir}/ bpms-roles.properties"/>

</login-module>

</authentication>

</security-domain>

note: kie-wb application should use the standalone-full.xml configuration.

Page 35: Drools & jBPM Workshop  Barcelona 2013

kie-wb installation and configuration

Enable sso for jbpm-dashbuilder:

● Set this configuration in the standalone-full.xml file.

<subsystem xmlns="urn:jboss:domain:web:1.1"

default-virtual-server="default-host" native="false">

<connector name="http" protocol="HTTP/1.1" scheme="http"

socket-binding="http"/>

<virtual-server name="default-host"

enable-welcome-root="true">

<alias name="localhost"/>

<alias name="example.com"/>

<sso/>

</virtual-server>

</subsystem>

Page 36: Drools & jBPM Workshop  Barcelona 2013

kie-wb installation and configuration

Application roles:

● kie-wb application roles (web.xml). <role-name>admin</role-name>

<role-name>analyst</role-name>

<role-name>developer</role-name>

<role-name>user</role-name>

<role-name>manager</role-name>

● jbpm-dashbuilder application roles (web.xml). <role-name>admin</role-name>

<role-name>user</role-name>

Page 37: Drools & jBPM Workshop  Barcelona 2013

kie-wb installation and configuration

Users configuration example:

● bpms-users.properties.admin=admin

john=john

mary=mary

jack=jack

katy=katy

● bpms-roles.properties.admin=admin,analyst

john=analyst,user,Accounting,PM

mary=analyst,user,HR

jack=analyst,user,IT

katy=analyst,user,HR

Page 38: Drools & jBPM Workshop  Barcelona 2013

kie-wb installation and configuration

Database configuration:

● kie-wb: WEB-INF/classes/META-INF/persistence.xml.

<persistence-unit name=" org.jbpm.domain" transaction-type="JTA">

<provider>org.hibernate.ejb.HibernatePersistence</provider>

<jta-data-source> java:jboss/datasources/ExampleDS</jta-data-source>

<properties>

<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />

<property name="hibernate.max_fetch_depth" value="3" />

<property name="hibernate.hbm2ddl.auto" value="update" />

<property name="hibernate.show_sql" value="false" />

</properties>

</persistence-unit>

</persistence>

Page 39: Drools & jBPM Workshop  Barcelona 2013

kie-wb installation and configuration

Datasource configuration:

● kie-wb: standalone-full.xml.

<datasource jndi-name=" java:jboss/datasources/ExampleDS" pool-name="ExampleDS"

enabled="true" use-java-context="true">

<!-- connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url --> <connection-url>jdbc:h2:~/kie-wb-db;DB_CLOSE_DELAY=-1</connection-url>

<driver>h2</driver>

<security>

<user-name>sa</user-name>

<password>sa</password>

</security>

</datasource>

Page 41: Drools & jBPM Workshop  Barcelona 2013

kie-wb installation and configurationApplication deployment:● Deployment should be done in this order, kie-wb

application first, and then jbpm-dashbuilder application.

● Using Wildfly management console.http://localhost:9990/console/App.html

● Command line scripts, etc.$ cd <jboss_home>/bin

$ ./jboss-cli.sh --connect --command="deploy

<path_to_war_file>"

<path_to_war_file>: path to the application war file.

$ ./jboss-cli.sh --connect --command="deploy /home/wmedvede/development/workshop-bcn/distributions/kie-wb-6.1.0-SNAPSHOT-jboss-as7.war"

Page 42: Drools & jBPM Workshop  Barcelona 2013

kie-wb installation and configuration

Start and access the application

● Server start$ ./standalone.sh -c standalone-full.xml

$ ./standalone.sh --server-config=standalone-full.xml

Use the -Dorg.kie.demo=false option to avoid installation of demo repositories if needed.$ ./standalone.sh -c standalone-full.xml -Dorg.kie.demo=false

● Access the applicationhttp://localhost:8080/kie-wb-6.1.0-SNAPSHOT-jboss-as7

Page 43: Drools & jBPM Workshop  Barcelona 2013

kie-wb installation and configuration

Application state directories:

jboss-as-7.1.1.Final/bin.niogit: local git repositories data.

.index: lucene index data.

.security: keystore for git ssh authentication.

/repositories/kie: application m2 repository.

jboss-as-7.1.1.Final/standalone/dataDeployed sessions ids informationorg.jbpm:HR:1.0-jbpmSessionId.sertest:Tests:1.0-jbpmSessionId.ser

Page 44: Drools & jBPM Workshop  Barcelona 2013

Workshop

● Look at the jBPM Playground Git repository● https://github.com/droolsjbpm/jbpm-playground

Page 45: Drools & jBPM Workshop  Barcelona 2013

From: https://github.com/droolsjbpm/jbpm-playgroundArticle: http://salaboy.com/2013/10/11/using-the-jbpm-console-ng-hr-example/ Look for the test project in the jbpm-playground repo

Human Resources Example

Page 46: Drools & jBPM Workshop  Barcelona 2013

Customer Relationships Example

From: https://github.com/droolsjbpm/jbpm-playgroundUses: http://www.service-repository.com/operation/operations?id=30Article: http://salaboy.com/2013/10/22/kie-wb-jbpm-console-ng-configurations/Look for the WorkItemHandlers implementation project Look for the test project in the jbpm-playground repo

Page 47: Drools & jBPM Workshop  Barcelona 2013

General Configurations

● User/Groups/Roles○ Where should I configure it?○ Look here: http://salaboy.com/2013/10/22/kie-wb-jbpm-console-ng-

configurations/

● Work Item Handlers (Service Connectors)○ What do I need? ○ Look here: http://salaboy.com/2013/10/22/kie-wb-jbpm-console-ng-

configurations/

● Getting access to the GIT repositories○ How do I access to the local GIT repository?○ Let’s do it!

Page 48: Drools & jBPM Workshop  Barcelona 2013

REST Endpoints

● For the BPM Side you can interact with the Process Runtimes using a REST endpoint (https://github.com/droolsjbpm/droolsjbpm-integration/wiki)

● You can execute your operations against a KIE WB running instance

● Project: jbpm-rest-client also from the jbpm-playground repo

Page 49: Drools & jBPM Workshop  Barcelona 2013

Community / Further Reading

● IRC: irc.freenode.net ○ #drools○ #jbpm

● jBPM Forums / Drools Mailing List○ www.drools.org and www.jbpm.org○ New web page coming!

● Blogs○ blog.athico.com○ kverlaen.blogspot.com○ mswiderski.blogspot.com○ salaboy.com○ pefernan.wordpress.com

Page 50: Drools & jBPM Workshop  Barcelona 2013

¡Muchas Gracias!¿Preguntas?


Recommended