jBPM5 in action - a quickstart for developers

download jBPM5 in action - a quickstart for developers

If you can't read please download the document

Transcript of jBPM5 in action - a quickstart for developers

PowerPoint Presentation

jBPM5 in Action:
A Quickstart for Developers

Kris VerlaenenjBPM5 Lead Engineer

Overview

What is (j)BPM?

Why BPM?

Getting started with jBPM5

Testing, debugging, deploying

Integrating in your architecture

Persistence and transactions

Console

What is BPM?

A business process is a process that describes
the order in which a series of steps need to be executed,
using a flow chart.

Business Process Management

Why BPM?

Visibility

Monitoring

Higher-level

Continuous improvement

Speed of development

Increased agility

Getting started with jBPM5 !

Key Characteristics of jBPM5

Open-source business process management project offering:

generic process engine supporting native BPMN 2.0 execution

targeting developers and business users

collaboration, management and monitoring using web-based consoles

powerful rules and event integration

From Workflow to BPM

Core engine is a workflow engine in pure Java

state transitions

lightweight

embeddable

generic, extensible

CoreEngine

Core Engine

KnowledgeBaseStatefulKnowledgeSessionProcessDefinition

ProcessInstance

BPMN 2.0 Example

System.out.println("Hello World");

System.out.println("Hello World");

Java Interface

ProcessRuntime interfacestartProcess(processId)

startProcess(processId, parameters)

signalEvent(type, event)

signalEvent(type, event, instanceId)

abortProcessInstance(instanceId)

getProcessInstance(instanceId)

Java Example

// (1) Create knowledge base and add process definitionKnowledgeBuilder kbuilder = ...kbuilder.add( ..., "sample.bpmn", ResourceType.BPMN2);KnowledgeBase kbase = kbuilder.newKnowledgeBase();// (2) Create new stateful knowledge sessionStatefulKnowledgeSession ksession =
kbase.newStatefulKnowledgeSession();// (3) Start a new process instanceksession.startProcess(com.sample.bpmn.hello);

TITLE SLIDE: HEADLINE

Presenter nameTitle, Red HatDate

Demo

Domain-specific Processes

Extend palette with domain-specific, declarative service nodes

define input / output parameters

runtime binding

Example: Notification

[ [ "name" : "Notification", "parameters" : [ "Message" : new StringDataType(), "From" : new StringDataType(), "To" : new StringDataType(), "Priority" : new StringDataType(), ], "displayName" : "Notification", "icon" : "icons/notification.gif" ]]

Example: Notification

class NotificationHandler implements WorkItemHandler { public void executeWorkItem(WorkItem wI, WorkItemManager manager) { String from = (String) wI.getParameter("From"); String to = (String) wI.getParameter("To"); String m = (String) wI.getParameter("Message"); // send email EmailService service = ...; service.sendEmail(from, to, "Notification", m); manager.completeWorkItem(wI.getId(), null); }}

Human task service

User task

Human task service (WS-HT)

Task lists

Task life cycle

Task clients

Task forms

Human Task Service

publicvoidstart(longtaskId,StringuserId,..)

publicvoidstop(longtaskId,StringuserId,..)

publicvoidrelease(longtaskId,StringuserId,..)

publicvoidsuspend(longtaskId,StringuserId,..)

publicvoidresume(longtaskId,StringuserId,..)

publicvoidskip(longtaskId,StringuserId,..)

publicvoiddelegate(longtaskId,StringuserId,
StringtargetUserId, ..)

publicvoidcomplete(longtaskId,StringuserId,
ContentDataoutputData, ..)

Testing, debugging, deploying, etc.

MiningAnalysisOptimizationSimulationTestingDesignMonitoringReportingExecution

IntegrationDeploymentManagementAudit

HumanInteractionCollaboration

Model

Deploy

Execute

Monitor

Analyze

Life
Cycle

JUnit Testing

public class MyProcessTest extends JbpmJUnitTestCase { public void testProcess() { StatefulKnowledgeSession ksession = createKnowledgeSession("sample.bpmn"); ProcessInstance pI = ksession.startProcess("com.sample.bpmn.hello"); assertProcessInstanceCompleted(pI.getId(), ksession); assertNodeTriggered(pI.getId(), "StartProcess", "Hello", "EndProcess"); }}

Debugging

TITLE SLIDE: HEADLINE

Presenter nameTitle, Red HatDate

Demo

Guvnor

Guvnor as knowledge repository

BPMN2 processes

Task and process forms

Model

Web-based process editor (Oryx)

Build, deploy, test, manage and collaboration features

TITLE SLIDE: HEADLINE

Presenter nameTitle, Red HatDate

Demo

Integrating in your Architecture

Architecture

From embedded to as a service

Command-based

Different underlying technologiesJava component (embedded, JNDI)

REST service

Web service

EJB

# of (independent) session

REST API

Integration

Integration

Integration

Integration

Persistence and Transactions

Persistence and Transactions

Persistence (JPA, pluggable)Runtime persistence

History logging

Services

Transactions (JTA, pluggable)Command-scoped

User-defined

Persistence

Create a persistent knowledge session

EntityManagerFactory emf = Persistence.createEntityManagerFactory( "..." );Environment env = KnowledgeBaseFactory.newEnvironment();env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env );

JPAWorkingMemoryDbLogger logger = new JPAWorkingMemoryDbLogger(ksession);

Persistence

InstanceIdLastModificationDateLastReadDateProcessIdProcessInstanceByteArrayStartDateStateProcessInstanceInfo

OptLockProcessInstanceLog

ProcessInstanceIdProcessIdStartDateIdEndDateNodeInstanceLog

NodeInstanceIdNodeIdIdLogDateProcessInstanceIdProcessIdType

User Transactions

Environment env = KnowledgeBaseFactory.newEnvironment();env.set( EnvironmentName.TRANSACTION_MANAGER,TransactionManagerServices.getTransactionManager() );

UserTransaction ut = (UserTransaction) new InitialContext().lookup("java:comp/UserTransaction");ut.begin();// do stuff here, e.g. ksession.startProcess(..)ut.commit();

Console

Console

Web-based management

Business user

Features

Process instance management

User task lists / forms

Reporting

TITLE SLIDE: HEADLINE

Presenter nameTitle, Red HatDate

Demo

jBPM5: What, where?

jBPM home page

Source http://github.com/droolsjbpm/jbpm

Hudson http://hudson.jboss.org/hudson/job/jBPM

Blog http://kverlaen.blogspot.com/

#jbpm on irc.codehaus.org

[email protected]

jBPM user forum

jBPM5 in Action:
A Quickstart for Developers

Kris VerlaenenjBPM5 Lead Engineer

Click to edit the title text format