Drools & jBPM Workshop Barcelona 2013


Published on

for more information visit: http://salaboy.com

Published in: Technology, Business
1 Comment
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Drools & jBPM Workshop Barcelona 2013

  1. 1. Drools & jBPM Workshop 2013 Diciembre · Barcelona Pere Fernandez · Walter Medvedeo · Mauricio Salatino
  2. 2. Agenda ● ● ● ● ● ● Drools & jBPM introduction New Technology Stack Tooling Installation & Configuration Workshop Q&A
  3. 3. 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.
  4. 4. 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
  5. 5. jBPM Example Hiring a new Developer Example
  6. 6. 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
  7. 7. 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
  8. 8. Drools Example ○ One Rule Example Rule “5% discount to silver customers” when $c: Customer( type == ‘silver’ ) $p: Purchase( customer == $c ) then $p.setDiscount(“0.05”); end
  9. 9. 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
  10. 10. 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
  11. 11. 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
  12. 12. CDI for KIE Project ● From: https://github.com/droolsjbpm/drools/tree/master/droolsexamples-cdi
  13. 13. KIE Project ● Structure (Maven Standard + kmodule.xml) Standard pom.xml File Resources / Knowledge Assets Business Process KIE Module Descriptor Forms
  14. 14. KModule ● Convention Driven ● Or you can add custom configurations
  15. 15. Whole new Tooling!!!!
  16. 16. KIE Workbench - Technology Stack
  17. 17. 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
  18. 18. Home ● The Knowledge Lifecycle ○ ○ ○ ○ ○ Authoring Runtime Configurations Process Management Task Management Business Activity Monitoring
  19. 19. Authoring Perspective - Administration ● Manage Organization Units ● Creating new repository ● Cloning existing repos ○ https://github.com/droolsjbpm/jbpm-playground ● Removing existing repositories
  20. 20. Authoring Perspective - Assets ● Navigate through Organization Units, KIE Projects… ● Creating new KIE Projects ● Creating Knowledge Assets
  21. 21. 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
  22. 22. Process Designer (New Item > Business Process) ● ● ● ● Based on BPMN 2.0 Context Menu for easy creation of flows Visual validation Simulation of business process
  23. 23. 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
  24. 24. Form Modeler (II)
  25. 25. Building & Deploying a Project ● Project Editor ○ Project Dependencies ○ Build & Deploy ○ Deployment Perspective
  26. 26. What happens when we Build & Deploy a Project?
  27. 27. 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)
  28. 28. 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
  29. 29. Business Activity Monitoring ● Dashboard ○ Generic Business Dashboard ○ Business Process Dashboard ○ Task Dashboard
  30. 30. 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
  31. 31. 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/
  32. 32. 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 server cd <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.
  33. 33. 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 installation http://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.
  34. 34. kie-wb installation and configuration Security 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.
  35. 35. 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>
  36. 36. 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>
  37. 37. 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
  38. 38. 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>
  39. 39. 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>
  40. 40. kie-wb installation and configuration Database configuration for jbpm-dashbuilder: https://github.com/droolsjbpm/jbpmdashboard/blob/master/jbpm-dashboarddistributions/src/main/jbossas7/README.md
  41. 41. kie-wb installation and configuration Application 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/workshopbcn/distributions/kie-wb-6.1.0-SNAPSHOT-jboss-as7.war"
  42. 42. kie-wb installation and configuration Start and access the application ● Server start standalone-full.xml $ ./standalone.sh -c $ ./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 demo=false standalone-full.xml -Dorg.kie. ● Access the application http://localhost:8080/kie-wb-6.1.0-SNAPSHOT-jboss-as7
  43. 43. 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/data Deployed sessions ids information org.jbpm:HR:1.0-jbpmSessionId.ser test:Tests:1.0-jbpmSessionId.ser
  44. 44. Workshop ● Look at the jBPM Playground Git repository ● https://github.com/droolsjbpm/jbpm-playground
  45. 45. Human Resources Example From: https://github.com/droolsjbpm/jbpm-playground Article: http://salaboy.com/2013/10/11/using-the-jbpm-console-ng-hr-example/ Look for the test project in the jbpm-playground repo
  46. 46. Customer Relationships Example From: https://github.com/droolsjbpm/jbpm-playground Uses: http://www.service-repository.com/operation/operations?id=30 Article: 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
  47. 47. General Configurations ● User/Groups/Roles ○ Where should I configure it? ○ Look here: http://salaboy.com/2013/10/22/kie-wb-jbpm-console-ngconfigurations/ ● Work Item Handlers (Service Connectors) ○ What do I need? ○ Look here: http://salaboy.com/2013/10/22/kie-wb-jbpm-console-ngconfigurations/ ● Getting access to the GIT repositories ○ How do I access to the local GIT repository? ○ Let’s do it!
  48. 48. 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 jbpmplayground repo
  49. 49. 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
  50. 50. ¡Muchas Gracias! ¿Preguntas?