community day 2013 - Consulting talks about camunda BPM Best Practices

Preview:

DESCRIPTION

 

Citation preview

Best Practices from Real-Life

falko.menge@camunda.com

bernd.ruecker@camunda.com

Who we are

Consulting

What we do:• Trainings• Proof of Concepts• Pre-Sales• Coaching• Consulting• ...

Real-Life @docs.camunda.org

Examples

Check out github

And Tutorials and How-Tos

Once a month

Always Mondays, 17.00 – 18.30

Hosted via WebEx

Currently in German

Online Working Group Best Practices

Organization via Meetings and Confluence

https://app.camunda.com/confluence/display/BestPractices/

One example: Data in Processes

Normally: References

UI

Process Id

Current Activity

15487

do something

Customer Id

Name

666

camunda

Address

Zip

Zossener Str.

10961

City

Country

Berlin

DE

Data in ProcessContext Domain

DataPE DB

External Data

Scope „Process“

Scope „Data“Scope „Process“

Process Engine Tables

Process VariableExternal Data

(Reference and Service Call)

VARIABLE

var1Var2...

value118...

VARIABLE

orderId...

19...

ORDER

1920...

...

...

...

...

...

...

EntityTables

Process Engine Tables

Patterns

Default Behavior:

1. New version created in DB upon each change in BPMN XML

2. New process instances start with the latest version

3. Running process instances continue using the version they started

with

It is normal to have multiple process versions in parallel.

Process Versioning

Imagine a Process Application

my-application.war

MyClass.java

task-form.xhtml

some-library.jar

my-process

Process Engine

Container

Add version number to affected artifacts:

Limitations

Doesn’t work for libraries

Complete redesign => Version 2.0

Small Changes: Bugfixes or Minor Feature Additions

my-application.war

MyClass.java

MyClassV2.java

task-form.xhtml

my-process

task-form-v2.xhtml

some-library.jar

Running Multiple Versions in Parallel

my-application-v2.0.war

MyClass.java

task-form.xhtml

some-library-v2.0.jar

my-process-v2.0

my-application-v1.0.war

MyClass.java

task-form.xhtml

some-library-v1.0.jar

my-process-v1.0

Process Engine

Container

JPA, EJB, JTA …

Maven Resource Filtering for getting major and minor version number into BPMN process id (=process definition key)

Process Definition Isolation

Include major and minor version in final name

Class Loader Isolation

Build Helper Plugin to parse version number

Running Multiple Versions in Parallel

Alternative: Multiple Apps register for same Process

my-application-v2.0.war

MyClass.java

task-form.xhtml

some-library-v2.0.jar

my-process

my-application-v1.0.war

MyClass.java

task-form.xhtml

some-library-v1.0.jar

my-process

Process Engine

Container

JPA, EJB, JTA …

<process id="my-process" version="1.0" …

Process Application registers for selected Process Versions

@ProcessApplication

public class MyProcessAppliaction extends EjbProcessApplication {

@PostDeploy

public void registerProcessApplication(

ProcessEngine processEngine,

ProcessApplicationInfo processApplicationInfo

){

// Find Process Version based on XML attribute

// Register Process Archive for Process Version

processEngine.getManagementService()

.registerProcessApplication(

processDefinitionDeploymentId,

processApplicationReference);

}

}

<process id="my-process" version="1.0" …

Now a couple of quickies We show

different examples

one minute each

with automatic slide changes

pa1.war

pa2.war

tasklist.war

Variant 1Task Form = simple HTML snippet

Variant 21 Form Portlet per Deployment

Variant 31 Portlet per Task Form

Variant 4Single Deployment

pa1.war

generic formportlet

tasklist.war

load HTML

generic formportlet

pa1.war

tasklist.war

tasklist.war

generic formportlet

Liferay

pa1.war

pa2.war

tasklist.war

Variant 1Task Form = simple HTML snippet

Variant 21 Form Portlet per Deployment

Variant 31 Portlet per Task Form

Variant 4Single Deployment

pa1.war

generic formportlet

tasklist.war

load HTML

generic formportlet

pa1.war

tasklist.war

tasklist.war

generic formportlet

Liferay

<bpmn2:userTask

id="UserTask_2" name="Task 2„

camunda:formKey="TaskFormPortlet,someText,datum" >

pa1.war

pa2.war

tasklist.war

Variant 1Task Form = simple HTML snippet

Variant 21 Form Portlet per Deployment

Variant 31 Portlet per Task Form

Variant 4Single Deployment

pa1.war

generic formportlet

tasklist.war

load HTML

generic formportlet

pa1.war

tasklist.war

tasklist.war

generic formportlet

Liferay

<bpmn2:userTask

id="UserTask_2" name="Task 2„

camunda:formKey="TaskFormPortlet,someText,datum" >

Asynchronous Continuation & Error Handling

taskService.complete(id)

1

2

1st TX 3rd TX2nd TX

camunda BPM Job ExecutorThread

3

Application / Client Thread

camunda:async=‘‘true“

public class AsyncOnErrorActivityBehavior extends TaskActivityBehavior

implements ActivityBehavior {

public void execute(ActivityExecution execution) throws Exception {

try {

executeBusinessLogic(execution);

leave(execution);

} catch (Exception e) {

createAsynchronousContinuationJob(execution, e);

}

Remove the need for an ESB

JBoss AS

MandantenDeployment

MandantenDeployment

Globale Processes

Sch

ed.

Enti

ties

JBoss AS

Java EE(JPA, EJB, JTA, …)

Process Engine

ConfigurationRepository

BusinessDeployment

UI

Del

eg.

Enti

ties

Del

eg.

Ru

les

BP

MN

Input Management

BP

MN

Sch

ed.

CRM

Engine

async

Job Execution

JMS

Businss-IT-Alignment

the process modela joined artifact!

Incidents

IncidentEntity newIncident

= IncidentEntity.createAndInsertIncident(

"myCustomIncidentType", execution.getId(),

"my-incident-data", "A custom incident message.");

newIncident.createRecursiveIncidents();

cockpit PlugIns

https://github.com/camunda/camunda-bpm-examples/

Showing:• Running• Incidents• Started in last 2 hours• Running longer than

24 hours

Dynamically modify a task during its creation in a task list

“Task with terri- bly long name” => “Task with terribly long name”

TaskListener

BpmnParseListener

ProcessEnginePlugin

Process Engine Plugins e.g. Task Name Beautifier

done.

now get going

have fun in your

projects

and join the

online working group