jBPM5 Community Training
    Sponsored by Plugtree
Module 1: jBPM5 Introduction

      jBPM5 Community Training
        version: 1.0-SNAPSHOT
       Release Date: 01/28/2011
  Under The Creative Common License
Module 1: jBPM5 Introduction

 jBPM5 Community Training Course by
 Mauricio "Salaboy" Salatino is licensed
 under a Creative Commons Attribution
           3.0 Unported License.
 Based on a work at salaboy.wordpress.
                   com.
  Permissions beyond the scope of this
    license may be available at http:
        //salaboy.wordpress.com/.
Agenda


jBPM Project History
jBPM5 Overview
jBPM5 Goals
Classic BPMS vs jBPM5 architecture (Competitors)
BPMN2 Standard
jBPM5 features
Developing Applications with jBPM5
Conclusions
jBPM Project History


jBPM 3.x borns as a BPMS (Business Process Management
System)
It was classified by JBoss as an integration software
Until jBPM 4.x Tom Baeyens was in charge of the project
Tom Baeyens quit JBoss and joins Alfresco
jBPM Project History (Drools)


Drools was born as a Rule Engine.
Mark Proctor is the current project leader.
In Drools version 4.x a new module appear called Drools
Flow.
The main idea behind Drools Flow was to provide BPMS
capabilities on top of the Rule Engine.
Kris Verlaenen, Phd was in charge of the Drools Flow
initiative, writing it from the scratch.
The main goal of Drools is to provide a platform where rules
and business processes can live, coexist and collaborate as
Knowledge Representations.
jBPM Project History


Drools Flow 5.x was released back in 2009
The rebranded version of Drools Flow, jBPM5 was
released on December of 2010
Provides a rock solid BPMS core and a flexible
mechanisms to implement the main stages of the BPM
discipline
Totally based on BPMN2
jBPM5 was conceived having in mind the code base of
Drools Flow and covering all the functionality provided
by jBPM 4.x
jBPM 5.x is a mature code base with more than 3 years of
development and several testing.
jBPM Project History


The main difference between jBPM5 and other BPMS's is
the fact that jBPM5 runs on top of Drools Expert (Rule
Engine), providing amazing features like:
   The possibility of doing inferences over our business
   processes
   Handling process exceptional paths using business
   rules
   Mixing Complex Event Processing, Rules and
   Processes together without learning a new API for
   each topic
jBPM5 Overview
jBPM5 Overview


It is a bridge between Business Analysts and Developers
Apache ASL Licensed
Central concept inside jBPM5: Business Process
BPMS = BPM System
     Design / Model (Eclipse Plug in - Web Based Editor)
     Execute (runtime to execute our processes)
     Monitor / Optimize (BAM and Reporting tools)
Tightly coupled with the rule engine
     allow us to represent complex situations (real life is
     complex)
Business Process


hmm.. but wait a second, What is a business process?


          "A sequence of activities,
      performed by humans or systems
        to complete a business goal"
Business Process Example

Simple Emergency Service Process
jBPM5 Features


It provides you a flexible platform for designing and
executing your business processes
It provides you an integrated set of APIs for the Rule
Engine, Process Engine and the Complex Event Processing
Engine
It provides you a platform to build our applications using
business processes to guide the company work
It provides you an abstraction about how your company's
activities are orchestrated
It provides a simple and automated mechanism to handle
information across activities
jBPM5 competitors

   Workflow          BPMS          BPMS
Execution Engine   jBPM 3.x   jBPM 4.x / Activiti
OSWorkflow


Workflow wf = new BasicWorkflow(username);
HashMap inputs = new HashMap();
inputs.put("docTitle", request.getParameter
("title"));
wf.doAction(1, 1, inputs);
jBPM 3.x


ProcessDefinition processDefinition = ProcessDefinition
                             .parseXmlResource("process-def.
xml");
ProcessInstance processInstance = new
                               ProcessInstance
(processDefinition);
processInstance. signal();
jBPM 4.x


ProcessEngine processEngine = new Configuration()
              .setResource(configurationResource)
              . buildProcessEngine();

ExecutionService executionService = processEngine
                                             .
getExecutionService();
executionService. startProcessInstanceByKey("simpleProcess");
Activiti5


ProcessEngine processEngine = new ProcessEngineBuilder()
          .configureFromPropertiesResource(configurationResource)
          . buildProcessEngine();

RuntimeService runtimeService = processEngine
                                             . getRuntimeService();
runtimeService. startProcessInstanceByKey("simpleProcess");
Classic BPMS and Rule Engine Interaction
Classic BPMS and Rule Engine Interaction


Drawbacks of the classic approach:

   The Rule Engine and the BPMS uses different APIs
   Sharing information between the Rule Engine and the
   BPMS becomes complicated and difficult to maintain
   Our Business Processes become very complex when we
   describe the exceptional paths using a process centric vision.
   We can leverage the declarative approach of business rules
   to describe exceptional situations.
Spaghetti BPEL of hell
Inversion of Control


Business Processes and Business Rules run on top of the
Rule Engine
Inversion of Control


Benefits:

   Tightly coupled design
   Process Centric vision for common branches
   Exceptions are handled in a cleaner way with rules
      Using a declarative approach
   No problems with communications and marshaling
   We don't need to learn different APIs
Once again, Business Process




       "A sequence of activities,
   performed by humans or systems
     to complete a business goal"
Business Process Structure


Directed Graph Composed of:
   Nodes (Activities)
   Connections (SequenceFlows)
       Outgoing and Incoming
Business Process Structure



Internal Structure:
   Process
      Node Container
          Node
Simple Process (BPMN2)

<process processType="executable" id="Sample" name="Sample Process" >
  <!-- nodes -->
  <startEvent id="_1" name="StartProcess"    />
  <scriptTask id="_3" name="Hello World"    >
    <script>System.out.println("Hello World!");</script>
  </scriptTask>
  <endEvent id="_2" name="End" >
      <terminateEventDefinition/>
  </endEvent>
  <!-- connections -->
  <sequenceFlow sourceRef="_3" targetRef="_2" />
  <sequenceFlow sourceRef="_1" targetRef="_3" />
</process>
Business Process Definitions

At runtime jBPM5 load the XML process definitions to
an Object Model that contains the process structure
Business Process Runtime

Based on the process structure that jBPM5 creates, we
can create new Processes Instances
These Processes Instances will represent living process
executions
Developing Applications


For developing applications with jBPM5 you will need to
know:
   Project library dependencies
   Understand the concept of KnowledgeBuilder,
   KnowledgeBase and KnowledgeSession
   Basic jBPM5 APIs
Project Dependencies


   Maven project dependencies of jBPM5 can be
   found at JBoss Maven Repositories:
    <repositories>
        <repository>
            <id>JBoss Maven Repo</id>
            <name>jboss</name>
            <url>https://repository.jboss.
org/nexus/content/groups/public/</url>
         </repository>
    </repositories>
Project Dependencies


The jBPM artifacts that you must use in your
projects are:
   <dependency>
       <groupId>org.jbpm</groupId>
       <artifactId>jbpm-flow</artifactId>
       <version>5.0-SNAPSHOT</version>
   </dependency>
   <dependency>
       <groupId>org.jbpm</groupId>
       <artifactId>jbpm-flow-builder</artifactId>
       <version>5.0-SNAPSHOT</version>
   </dependency>
   <dependency>
       <groupId>org.jbpm</groupId>
       <artifactId>jbpm-bpmn2</artifactId>
       <version>5.0-SNAPSHOT</version>
   </dependency>
KBase and KSession


Knowledge Base: it will represent a compiled and static
representation of our business assets. The knowledge base is
constructured using a Knowledge Builder that will compile our
knowledge assets into knowledge packages. The knowledge base
can be composed of 1..N knowledge packages.

Knowledge Session: it represent our runtime environment. A
knowledge session is created based on a knowledge base and it will
contain a living version (in memory) of our knowledge assets. Our
applications will interact with it. It will contain our processes and
rules running inside it.
Basic APIs


KnowledgeBuilder and KnowledgeBuilderFactory
KnowledgeBase and KnowledgeBaseFactory
StatefulKnowledgeSession
KnowledgeBuilder


It will compile our business assets into a binary and
optimized format
This process is expensive and must be avoided in production
systems
We usually build our packages once and then store the
binary result in a repository to reuse them
Useful methods
    add(KnowledgeResource resource, ResourceType type)
    getErrors()
    getKnowledgePackages()
KnowledgeBase


It will contain our Knowledge packages
It represents a static version of our knowledge assets
Useful methods
    addKnowledgePackage(KnowledgePackage)
    newStatefulKnowledgeSession()
StatefulKnowledgeSession


Easy and cheap to create
It will represent our runtime environment
Our processes will run inside a StatefulKnowledgeSession
Useful methods
    startProcess(String processId, Map parameters)
    signalEvent(String eventId, Object event, Long
    processId)
    For rules, insert, update, retract, fireAllRules()
    For events: getWorkingMemoryEntryPoint(String
    name)
We have learned ...


jBPM5 is a BPMS that runs on top of Drools Expert (Rule
Engine)
Knowing the project library dependencies and the jBPM5
artifact dependencies we can create our first jBPM5 project
Using the Basic APIs we can set up easily our runtime
environment
Stay tuned for the next modules that will explain important
topics such as:
    The Business Process Management Discipline
    The Business Process Modeling and Notation V2
    Human Interactions inside our processes
    etc.
Next Modules


Stay tuned for the next modules that will explain important
topics such as:
   The Business Process Management Discipline
   The Business Process Modeling and Notation V2
   Human Interactions inside our processes
   etc.
Related Links


You can find more information, examples, tutorials and
more in:
   Official documentation
      http://hudson.jboss.
      org/hudson/job/jBPM5/lastSuccessfulBuild/artifact/
      target/jbpm-5.0-SNAPSHOT-docs-build/jbpm-
      docs/html/index.html
   Blog Athico:
      http://blog.athico.com
   Salaboy Blog
      http://salaboy.wordpress.com
   Plug Tree Blog
      http://www.plugtree.com
Enjoy! and be patient for the first
Hands On Labs!
 
              
Questions?
 
                     
    Contact us at
www.plugtree.com

JBPM5 Community Training Course - Module #1 Introduction

  • 1.
        jBPM5 Community Training Sponsored by Plugtree
  • 2.
    Module 1: jBPM5Introduction jBPM5 Community Training version: 1.0-SNAPSHOT Release Date: 01/28/2011 Under The Creative Common License
  • 3.
    Module 1: jBPM5Introduction jBPM5 Community Training Course by Mauricio "Salaboy" Salatino is licensed under a Creative Commons Attribution 3.0 Unported License. Based on a work at salaboy.wordpress. com. Permissions beyond the scope of this license may be available at http: //salaboy.wordpress.com/.
  • 4.
    Agenda jBPM Project History jBPM5Overview jBPM5 Goals Classic BPMS vs jBPM5 architecture (Competitors) BPMN2 Standard jBPM5 features Developing Applications with jBPM5 Conclusions
  • 5.
    jBPM Project History jBPM3.x borns as a BPMS (Business Process Management System) It was classified by JBoss as an integration software Until jBPM 4.x Tom Baeyens was in charge of the project Tom Baeyens quit JBoss and joins Alfresco
  • 6.
    jBPM Project History(Drools) Drools was born as a Rule Engine. Mark Proctor is the current project leader. In Drools version 4.x a new module appear called Drools Flow. The main idea behind Drools Flow was to provide BPMS capabilities on top of the Rule Engine. Kris Verlaenen, Phd was in charge of the Drools Flow initiative, writing it from the scratch. The main goal of Drools is to provide a platform where rules and business processes can live, coexist and collaborate as Knowledge Representations.
  • 7.
    jBPM Project History DroolsFlow 5.x was released back in 2009 The rebranded version of Drools Flow, jBPM5 was released on December of 2010 Provides a rock solid BPMS core and a flexible mechanisms to implement the main stages of the BPM discipline Totally based on BPMN2 jBPM5 was conceived having in mind the code base of Drools Flow and covering all the functionality provided by jBPM 4.x jBPM 5.x is a mature code base with more than 3 years of development and several testing.
  • 8.
    jBPM Project History Themain difference between jBPM5 and other BPMS's is the fact that jBPM5 runs on top of Drools Expert (Rule Engine), providing amazing features like: The possibility of doing inferences over our business processes Handling process exceptional paths using business rules Mixing Complex Event Processing, Rules and Processes together without learning a new API for each topic
  • 9.
  • 10.
    jBPM5 Overview It isa bridge between Business Analysts and Developers Apache ASL Licensed Central concept inside jBPM5: Business Process BPMS = BPM System Design / Model (Eclipse Plug in - Web Based Editor) Execute (runtime to execute our processes) Monitor / Optimize (BAM and Reporting tools) Tightly coupled with the rule engine allow us to represent complex situations (real life is complex)
  • 11.
    Business Process hmm.. butwait a second, What is a business process? "A sequence of activities, performed by humans or systems to complete a business goal"
  • 12.
    Business Process Example SimpleEmergency Service Process
  • 13.
    jBPM5 Features It providesyou a flexible platform for designing and executing your business processes It provides you an integrated set of APIs for the Rule Engine, Process Engine and the Complex Event Processing Engine It provides you a platform to build our applications using business processes to guide the company work It provides you an abstraction about how your company's activities are orchestrated It provides a simple and automated mechanism to handle information across activities
  • 14.
    jBPM5 competitors Workflow BPMS BPMS Execution Engine jBPM 3.x jBPM 4.x / Activiti
  • 15.
    OSWorkflow Workflow wf =new BasicWorkflow(username); HashMap inputs = new HashMap(); inputs.put("docTitle", request.getParameter ("title")); wf.doAction(1, 1, inputs);
  • 16.
    jBPM 3.x ProcessDefinition processDefinition= ProcessDefinition .parseXmlResource("process-def. xml"); ProcessInstance processInstance = new ProcessInstance (processDefinition); processInstance. signal();
  • 17.
    jBPM 4.x ProcessEngine processEngine= new Configuration() .setResource(configurationResource) . buildProcessEngine(); ExecutionService executionService = processEngine . getExecutionService(); executionService. startProcessInstanceByKey("simpleProcess");
  • 18.
    Activiti5 ProcessEngine processEngine =new ProcessEngineBuilder() .configureFromPropertiesResource(configurationResource) . buildProcessEngine(); RuntimeService runtimeService = processEngine . getRuntimeService(); runtimeService. startProcessInstanceByKey("simpleProcess");
  • 19.
    Classic BPMS andRule Engine Interaction
  • 20.
    Classic BPMS andRule Engine Interaction Drawbacks of the classic approach: The Rule Engine and the BPMS uses different APIs Sharing information between the Rule Engine and the BPMS becomes complicated and difficult to maintain Our Business Processes become very complex when we describe the exceptional paths using a process centric vision. We can leverage the declarative approach of business rules to describe exceptional situations.
  • 21.
  • 22.
    Inversion of Control BusinessProcesses and Business Rules run on top of the Rule Engine
  • 23.
    Inversion of Control Benefits: Tightly coupled design Process Centric vision for common branches Exceptions are handled in a cleaner way with rules Using a declarative approach No problems with communications and marshaling We don't need to learn different APIs
  • 24.
    Once again, BusinessProcess "A sequence of activities, performed by humans or systems to complete a business goal"
  • 25.
    Business Process Structure DirectedGraph Composed of: Nodes (Activities) Connections (SequenceFlows) Outgoing and Incoming
  • 26.
    Business Process Structure InternalStructure: Process Node Container Node
  • 27.
    Simple Process (BPMN2) <processprocessType="executable" id="Sample" name="Sample Process" > <!-- nodes --> <startEvent id="_1" name="StartProcess" /> <scriptTask id="_3" name="Hello World" > <script>System.out.println("Hello World!");</script> </scriptTask> <endEvent id="_2" name="End" > <terminateEventDefinition/> </endEvent> <!-- connections --> <sequenceFlow sourceRef="_3" targetRef="_2" /> <sequenceFlow sourceRef="_1" targetRef="_3" /> </process>
  • 28.
    Business Process Definitions Atruntime jBPM5 load the XML process definitions to an Object Model that contains the process structure
  • 29.
    Business Process Runtime Basedon the process structure that jBPM5 creates, we can create new Processes Instances These Processes Instances will represent living process executions
  • 30.
    Developing Applications For developingapplications with jBPM5 you will need to know: Project library dependencies Understand the concept of KnowledgeBuilder, KnowledgeBase and KnowledgeSession Basic jBPM5 APIs
  • 31.
    Project Dependencies Maven project dependencies of jBPM5 can be found at JBoss Maven Repositories: <repositories> <repository> <id>JBoss Maven Repo</id> <name>jboss</name> <url>https://repository.jboss. org/nexus/content/groups/public/</url> </repository> </repositories>
  • 32.
    Project Dependencies The jBPMartifacts that you must use in your projects are: <dependency> <groupId>org.jbpm</groupId> <artifactId>jbpm-flow</artifactId> <version>5.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.jbpm</groupId> <artifactId>jbpm-flow-builder</artifactId> <version>5.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.jbpm</groupId> <artifactId>jbpm-bpmn2</artifactId> <version>5.0-SNAPSHOT</version> </dependency>
  • 33.
    KBase and KSession KnowledgeBase: it will represent a compiled and static representation of our business assets. The knowledge base is constructured using a Knowledge Builder that will compile our knowledge assets into knowledge packages. The knowledge base can be composed of 1..N knowledge packages. Knowledge Session: it represent our runtime environment. A knowledge session is created based on a knowledge base and it will contain a living version (in memory) of our knowledge assets. Our applications will interact with it. It will contain our processes and rules running inside it.
  • 34.
    Basic APIs KnowledgeBuilder andKnowledgeBuilderFactory KnowledgeBase and KnowledgeBaseFactory StatefulKnowledgeSession
  • 35.
    KnowledgeBuilder It will compileour business assets into a binary and optimized format This process is expensive and must be avoided in production systems We usually build our packages once and then store the binary result in a repository to reuse them Useful methods add(KnowledgeResource resource, ResourceType type) getErrors() getKnowledgePackages()
  • 36.
    KnowledgeBase It will containour Knowledge packages It represents a static version of our knowledge assets Useful methods addKnowledgePackage(KnowledgePackage) newStatefulKnowledgeSession()
  • 37.
    StatefulKnowledgeSession Easy and cheapto create It will represent our runtime environment Our processes will run inside a StatefulKnowledgeSession Useful methods startProcess(String processId, Map parameters) signalEvent(String eventId, Object event, Long processId) For rules, insert, update, retract, fireAllRules() For events: getWorkingMemoryEntryPoint(String name)
  • 38.
    We have learned... jBPM5 is a BPMS that runs on top of Drools Expert (Rule Engine) Knowing the project library dependencies and the jBPM5 artifact dependencies we can create our first jBPM5 project Using the Basic APIs we can set up easily our runtime environment Stay tuned for the next modules that will explain important topics such as: The Business Process Management Discipline The Business Process Modeling and Notation V2 Human Interactions inside our processes etc.
  • 39.
    Next Modules Stay tunedfor the next modules that will explain important topics such as: The Business Process Management Discipline The Business Process Modeling and Notation V2 Human Interactions inside our processes etc.
  • 40.
    Related Links You canfind more information, examples, tutorials and more in: Official documentation http://hudson.jboss. org/hudson/job/jBPM5/lastSuccessfulBuild/artifact/ target/jbpm-5.0-SNAPSHOT-docs-build/jbpm- docs/html/index.html Blog Athico: http://blog.athico.com Salaboy Blog http://salaboy.wordpress.com Plug Tree Blog http://www.plugtree.com
  • 41.
    Enjoy! and bepatient for the first Hands On Labs!
  • 42.
        Questions?
  • 43.
        Contact us at www.plugtree.com