Date post: | 05-Dec-2014 |
Category: |
Technology |
Upload: | salaboy-salaboy |
View: | 4,138 times |
Download: | 5 times |
Drools & jBPMWorkshop 2013Diciembre · Barcelona
Pere Fernandez · Walter Medvedeo · Mauricio Salatino
Agenda
● Drools & jBPM introduction● New Technology Stack● Tooling ● Installation & Configuration● Workshop● Q&A
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.
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
jBPM Example
Hiring a new Developer Example
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
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
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
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
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
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
CDI for KIE Project
● From: https://github.com/droolsjbpm/drools/tree/master/drools-examples-cdi
● Structure (Maven Standard + kmodule.xml)
KIE Project
Resources / Knowledge Assets
KIE Module Descriptor
Standard pom.xml File
Business Process
Forms
KModule
● Convention Driven
● Or you can add custom configurations
Whole new Tooling!!!!
KIE Workbench - Technology Stack
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
Home
● The Knowledge Lifecycle○ Authoring○ Runtime Configurations○ Process Management○ Task Management○ Business Activity Monitoring
Authoring Perspective - Administration
● Manage Organization Units● Creating new repository● Cloning existing repos
○ https://github.com/droolsjbpm/jbpm-playground● Removing existing repositories
Authoring Perspective - Assets● Navigate through Organization Units, KIE
Projects…● Creating new KIE Projects● Creating Knowledge Assets
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
Process Designer (New Item > Business Process)● Based on BPMN 2.0● Context Menu for easy creation of flows● Visual validation● Simulation of business process
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
Form Modeler (II)
Building & Deploying a Project● Project Editor
○ Project Dependencies○ Build & Deploy○ Deployment Perspective
What happens when we Build & Deploy a Project?
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)
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
Business Activity Monitoring● Dashboard
○ Generic Business Dashboard○ Business Process Dashboard○ Task Dashboard
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
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/
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.
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.
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.
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>
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>
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
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>
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>
kie-wb installation and configuration
Database configuration for jbpm-dashbuilder:
https://github.com/droolsjbpm/jbpm-dashboard/blob/master/jbpm-dashboard-distributions/src/main/jbossas7/README.md
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"
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
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
Workshop
● Look at the jBPM Playground Git repository● https://github.com/droolsjbpm/jbpm-playground
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
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
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!
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
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
¡Muchas Gracias!¿Preguntas?