Upload
salaboy-salaboy
View
10.154
Download
1
Tags:
Embed Size (px)
DESCRIPTION
The first module of the jBPM5 Community Training Courses. For more information visit: http://salaboy.wordpress.com
Citation preview
jBPM5 Community Training Sponsored by Plugtree
Module 1: jBPM5 Introduction
jBPM5 Community Trainingversion: 1.0-SNAPSHOT
Release Date: 01/28/2011Under 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 OverviewjBPM5 GoalsClassic BPMS vs jBPM5 architecture (Competitors)BPMN2 StandardjBPM5 featuresDeveloping Applications with jBPM5Conclusions
jBPM Project History
jBPM 3.x borns as a BPMS (Business Process Management System)It was classified by JBoss as an integration softwareUntil jBPM 4.x Tom Baeyens was in charge of the projectTom 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 2009The rebranded version of Drools Flow, jBPM5 was released on December of 2010Provides a rock solid BPMS core and a flexible mechanisms to implement the main stages of the BPM disciplineTotally based on BPMN2 jBPM5 was conceived having in mind the code base of Drools Flow and covering all the functionality provided by jBPM 4.xjBPM 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 processesHandling 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 engineallow 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 processesIt provides you an integrated set of APIs for the Rule Engine, Process Engine and the Complex Event Processing EngineIt provides you a platform to build our applications using business processes to guide the company workIt provides you an abstraction about how your company's activities are orchestratedIt provides a simple and automated mechanism to handle information across activities
jBPM5 competitors
Workflow Execution Engine
BPMSjBPM 3.x
BPMSjBPM 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 APIsSharing information between the Rule Engine and the BPMS becomes complicated and difficult to maintainOur 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 designProcess Centric vision for common branches Exceptions are handled in a cleaner way with rules
Using a declarative approach No problems with communications and marshalingWe 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 ContainerNode
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 InstancesThese 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 KnowledgeSessionBasic 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 KnowledgeBaseFactoryStatefulKnowledgeSession
KnowledgeBuilder
It will compile our business assets into a binary and optimized formatThis process is expensive and must be avoided in production systemsWe usually build our packages once and then store the binary result in a repository to reuse themUseful methods
add(KnowledgeResource resource, ResourceType type)getErrors()getKnowledgePackages()
KnowledgeBase
It will contain our Knowledge packagesIt represents a static version of our knowledge assets Useful methods
addKnowledgePackage(KnowledgePackage)newStatefulKnowledgeSession()
StatefulKnowledgeSession
Easy and cheap to createIt will represent our runtime environmentOur processes will run inside a StatefulKnowledgeSessionUseful 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 environmentStay tuned for the next modules that will explain important topics such as:
The Business Process Management DisciplineThe Business Process Modeling and Notation V2Human Interactions inside our processesetc.
Next Modules
Stay tuned for the next modules that will explain important topics such as:
The Business Process Management DisciplineThe Business Process Modeling and Notation V2Human Interactions inside our processesetc.
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 Bloghttp://www.plugtree.com
Enjoy! and be patient for the first Hands On Labs!
Questions?
Contact us atwww.plugtree.com