curso de jbpm5

Post on 27-Nov-2014

1.389 Views

Category:

Technology

6 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

1

JBPM5

1. Introducción

Oscar Vásquez Flores

eoscarvf@gmail.com

2013-03-28

2

JBPM5

Objetivos

Presentar al producto JBPM5 y su contexto.

3

JBPM5

Acerca de jBPM

* jBPM is a flexible Business Process Management (BPM)

Suite.

* It's light-weight, fully open-source

(distributed under Apache license) and written in Java.

* It allows you to model, execute and monitor business

processes, throughout their life cycle.

4

JBPM5

Características de jBPM

* The core of jBPM is a light-weight, extensible workflow

engine written in pure Java that allows you to execute

business processes using the latest BPMN 2.0

specification. It can run in any Java environment,

embedded in your application or as a service.

* Eclipse-based and web-based editor to support the

graphical creation of your business processes

(drag and drop)

* Pluggable persistence and transactions based on

JPA / JTA.

* History logging (for querying / monitoring / analysis) 5

JBPM5

Características de jBPM

* Pluggable human task service based on WS-HumanTask

for including tasks that need to be performed by

human actors

* Management console supporting process instance

management, task lists and task form management,

and reporting

* Task for builder to create, generate and/or edit task forms

Optional process repository to deploy your process

(and other related knowledge)

* Integration with Maven, Spring, OSGi, etc.

6

JBPM5

jBPM de JBoss

7

JBPM5

Soluciones de Red Hat

8

JBPM5

Componentes de JBPM

Core engine

Eclipse plugins

Web Designer

Console

Otros

9

JBPM5

jBPM Core engine.

* Solid, stable core engine for executing your process

instances

* Native support for the latest BPMN 2.0 specification for

modeling and executing business processes

* Strong focus on performance and scalability

* Light-weight (can be deployed on almost any device that

supports a simple Java Runtime Environment,

does not require any web container at all)

* (Optional) pluggable persistence with a default JPA

implementation.

10

JBPM5

jBPM Core engine.

* Pluggable transaction support with a default JTA

implementation.

* Implemented as a generic process engine, so it can be

extended to support new node types or

other process languages.

* Listeners to be notified of various events

* Ability to migrate running process instances to a new

version of their process definition.

11

JBPM5

jBPM Eclipse plugin.

12

Solo sirve como herramienta BPMN2

No sirve como herramienta a JBPM5

JBPM5

jBPM Web Designer.

13

Herramienta de diseño de procesos recomendada

por JBPM5

JBPM5

jBPM Console

14

JBPM5

Otros componentes de jBPM.

* Human task service.

* Process repository.

* History log.

* Form builder. *

15

JBPM5

Arquitectura de jBPM

16

JBPM5

Oscar Vásquez Flores

eoscarvf@gmail.com

2013-03-28

18

2. Preparando el ambiente

JBPM5

Objetivos

Preparar el ambiente de trabajo con JBPM5

19

JBPM5

Instalador de JBPM5

http://sourceforge.net/projects/jbpm/files/

20

JBPM5

JBPM5 versión 5.4

21

JBPM5

Archivos de instalación de JBPM5

22

JBPM5

Instalador del JBPM5 Web Process Designer

http://sourceforge.net/projects/jbpm/files/

23

JBPM5 24

Instalador del JBPM5 Web Process Designer

JBPM5

Ejemplo de ambiente en desarrollo

25

Local file BD Repositorio

(H2)

JBPM5

Repositorio de

usuarios Repositorio

interno

JBOSS7

JBPM5

Ejemplo de ambiente en producción

26

LDAP

(Apache DS) BD Repositorio

(Postgresql)

JBPM5

Repositorio de

usuarios Repositorio

interno

JBOSS7

JBPM5

3. Plugins de Eclipse para JBPM

Oscar Vásquez Flores

eoscarvf@gmail.com

2013-03-28

28

JBPM5

Objetivos

Mostrar las opciones de integración de JBPM con Eclipse.

29

JBPM5

Opciones de Plugin para Eclipse

I. JBPM Eclipse plugin

II. Eclipse BPMN 2.0 plugin

30

JBPM5

I. JBPM Eclipse plugin

* El primer plugin para diseñar procesos de JBPM.

* Soporta un pequeña parte de BPMN2.

* Incluye diversos utilitarios para trabajar con JBPM.

* Ya se descontinuo por parte de JBoss, pero sigue

siendo muy útil.

31

JBPM5

I. JBPM Eclipse plugin

32

JBPM5

I. JBPM Eclipse plugin – Integración con Drools Guvnor

33

JBPM5

I. JBPM Eclipse plugin – Integración con Drools Guvnor

34

JBPM5

Drools Guvnor

También conocido como Guvnor BRMS

Se instala con drools-guvnor.war

Parte del Drools Business Logic Integration Platform

(BLIP)

Objetivos:

Herramienta orienta al negocio para la gestion de

assets de negocio.

Repositorio de assets, puede ser accedido por

aplicaciones externas

35

JBPM5

Drools Guvnor

Soporta diferente tipos de assets:

Reglas de negocio

Tablas de decisión

Procesos de negocio

Etc.

Solo para el caso de la edicion de procesos de negocio

requiere al jBPM Web Process Designer(designer.war)

36

http://localhost:8080/drools-guvnor/

JBPM5

Drools Guvnor – Gestión de assets

37

JBPM5

Drools Guvnor – Exploración de assets

38

JBPM5

II. Eclipse BPMN 2.0 plugin

* Soporta gran parte de la especificación BPMN2.

* Creado para atender la necesidad de programar en Java

y diseñar procesos desde un solo IDE.

* Hasta el momento es un proyecto en

estado de incubación.

39

JBPM5

II. Eclipse BPMN 2.0 plugin

40

JBPM5

Soporte a BPMN2 durante el diseño de procesos

41

Especificación BPMN2

Eclipse BPMN2 Plugin

JBPM Eclipse

Plugin

JBPM Web Designer

JBPM5

4. Web Process Designer

Oscar Vásquez Flores

eoscarvf@gmail.com

2013-04-02

43

JBPM5

Objetivos

Conocer al jBPM Web Process Designer

44

JBPM5

jBPM5 Web Process Designer

45

http://localhost:8080/drools-guvnor

JBPM5

jBPM5 Web Process Designer

Construido sobre la aplicacion web Oryx

Oryx representa el diseño en formato JSON

Web Process Designer representa el diseño en formato

XML según la especificación BPMN2

Web Process Designer es la herramienta oficial de

diseño BPMN de jBPM5

Necesita una instancia de Drools Guvnor

46

JBPM5

Drools Guvnor – Creación de un proceso de negocio

47

JBPM5

Drools Guvnor – Creación de un proceso de negocio

48

JBPM5

Drools Guvnor – Edición de proceso de negocio

49

JBPM5

Drools Guvnor – Servicio de repositorio para nodos

50

JBPM5

Drools Guvnor – Organización de assets

51

JBPM5

Drools Guvnor – Atributos del asset

52

JBPM5

Drools Guvnor – Versionamiento del asset

53

JBPM5

Drools Guvnor – Eliminar un asset

54

JBPM5

Drools Guvnor – Subir definición de clases

55

JBPM5

Drools Guvnor – Subir definición de clases

56

JBPM5

Drools Guvnor – Creación de paquetes

57

JBPM5

5. El API Java para JBPM

Oscar Vásquez Flores

eoscarvf@gmail.com

2013-03-28

59

JBPM5

Objetivos

Conocer el API Java para JBPM

60

JBPM5

El Java API.

http://docs.jboss.org/jbpm/v5.4/javadocs/

Algunos paquetes importantes:

org.drools.*.*

org.jbpm.bpmn2.*.*

org.jbpm.compiler.*.*

org.jbpm.persistence.*.*

org.jbpm.process.*.*

org.jbpm.ruleflow.*.*

org.jbpm.task.*.*

org.jbpm.workflow.*.*

61

JBPM5

Clase KnowledgeBase

The jBPM API allows you to first create a knowledge base.

The Knowledge Base is a repository of all the application’s

knowledge definitions. It may contain rules, processes,

functions etc. The Knowledge Base itself does not

contain instance data, known as facts; instead, sessions

are created from the Knowledge Base into which data can

be inserted and where process instances may be started.

The following code snippet shows how to create a

knowledge base consisting of only one process definition.

62

JBPM5

Clase KnowledgeBase - Ejemplo

KnowledgeBuilder kbuilder =

KnowledgeBuilderFactory.newKnowledgeBuilder();

kbuilder.add(ResourceFactory.newClassPathResource("TestProcess.bpmn"),

ResourceType.BPMN2);

KnowledgeBase kbase = kbuilder.newKnowledgeBase();

63

JBPM5

Clase KnowledgeSession

Next step is to start a session to interact with created knowledge base.

The following code snippet shows how easy it is to create a session based on

the earlier created knowledge base, and to start a process.

Ejemplo:

StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

ProcessInstance processInstance = ksession.startProcess("first_test");

64

JBPM5

Parametros de entrada al proceso

You can also provide some input parameters to help you executing your

business logic meanwhile the process is executing. Following code sample

shows how to provide input parameters to a process execution.

Ejemplo:

Map<String, Object> inputParams = new HashMap<String, Object>();

inputParams.put("name", "i am an input parameter.");

ProcessInstance processInstance = ksession.startProcess("first_test",

inputParams

65

JBPM5

Eventos

JBPM API allows you to listens to some events during process execution to

interact with JBPM runtime. A ProcessEventListener can be used to listen

to process-related events, like starting or completing a process, entering and

leaving a node, etc. You can set your listener class using following line of code.

Ejemplo:

ksession.addEventListener(new TestEventListener());

66

JBPM5

Eventos - Implementación

import org.drools.event.process.*;

public class TestEventListener implements ProcessEventListener {

@Override

public void beforeNodeTriggered(ProcessNodeTriggeredEvent event) {

System.out.println("Before Node triggered. "+

event.getNodeInstance().getNodeName());

Object obj = event.getNodeInstance().getVariable("name");

System.out.println("Input Parameter of ProcessInstance: "+obj.toString());

}

@Override

public void afterNodeLeft(ProcessNodeLeftEvent arg0) {}

@Override

public void afterNodeTriggered(ProcessNodeTriggeredEvent arg0) {}

67

JBPM5

Eventos - Implementación

@Override

public void afterProcessCompleted(ProcessCompletedEvent arg0) {}

@Override

public void afterProcessStarted(ProcessStartedEvent arg0) {}

@Override

public void afterVariableChanged(ProcessVariableChangedEvent arg0) {}

@Override

public void beforeNodeLeft(ProcessNodeLeftEvent arg0) {}

@Override

public void beforeProcessCompleted(ProcessCompletedEvent arg0) {}

@Override

public void beforeProcessStarted(ProcessStartedEvent arg0) {}

@Override

public void beforeVariableChanged(ProcessVariableChangedEvent arg0) {}

}

68

JBPM5

Eventos – Descripción de algunos métodos.

* beforeNodeLeft(): Antes de ejecutar un nodo, por ejemplo una actividad.

* afterNodeLeft(): Luego de ejecutarse un nodo.

* beforeProcessCompleted(): Antes de terminar la instancia del proceso.

* beforeProcessStarted(): Antes de iniciar la ejecución de una instancia.

* beforeVariableChanged(): Antes de cambiar una variable de proceso.

69

JBPM5

Invocación a un proceso – Diseño de proceso local

70

JBPM5

Invocación a un proceso – Proceso en Guvnor

71

http://localhost:8080/drools-guvnor/

org.drools.guvnor.Guvnor/webdav/packages/com.procesos/PruebaProceso.bpmn2

JBPM5

Invocación a un proceso – Proceso en Guvnor

72

JBPM5

Invocación a un proceso – Paquete en Guvnor

73

JBPM5

Jars necesarios – Propios de JBPM

74

JBPM5

Jars necesarios – Externos a JBPM

75

. . .

JBPM5

6. JBPM Console

Oscar Vásquez Flores

eoscarvf@gmail.com

2013-04-02

77

JBPM5

Objetivos

Conocer el JBPM Console.

78

JBPM5

Acerca de JBPM Console

* Business processes can be managed through a

web console.

* This includes features like managing your process

instances (starting/stopping/inspecting),

inspecting your (human) task list and executing those

tasks, and generating reports.

* The jBPM console consists of two wars that must be

deployed in your application server and contains the

necessary libraries, the actual application, etc.

One jar contains the server application, the other

one the client.

79

JBPM5

JBPM Console

JBPM Console

JBPM Console

Server

80

Task Server

Drools Guvnor

Usuario

jbpm-gwt-console-server.war

jbpm-gwt-console.war

JBPM5

JBPM Console - Procesos

81

JBPM5

JBPM Console - Tareas

82

JBPM5

JBPM Console - Reportes

83

JBPM5

Configuración del JBPM Console

* jbpm-gwt-console-server.war

* jbpm.console.properties

84

JBPM5

Gestión de seguridad

* {Path}\jboss-as-7.1.1.Final\standalone\configuration

* users.properties

85

* roles.properties

JBPM5

Interface REST de la JBPM Console

86

* The console also offers a REST interface for the

functionality it exposes.

This for example allows easy integration with the process

engine for features like starting process instances,

retrieving task lists, etc.

* The list URLS that the REST interface exposes can be

inspected if you navigate to the following URL

(after installing and starting the console):

http://localhost:8080/gwt-console-server/rs/server/resources/jbpm

JBPM5

Interface REST de la JBPM Console

87

* For example, this allows you to close a task using

/gwt-console-server/rs/task/{taskId}/close

* or starting a new process instance using

/gwt-console-server/rs/process/definition/{id}/new_instance

JBPM5

Interface REST de la JBPM Console

88

JBPM5

7. Human task

Oscar Vásquez Flores

eoscarvf@gmail.com

2013-03-28

90

JBPM5

Objetivos

Revisar los temas relacionados a las tareas humanas.

91

JBPM5

kcontext

92

JBPM5

Propiedades del User Task

93

JBPM5

Propiedades del User Task – Formulario asociado

95

JBPM5

8. Business Activity Monitoring

Oscar Vásquez Flores

eoscarvf@gmail.com

2013-03-28

98

JBPM5

Objetivos

Business Activity Monitoring

99

JBPM5

Business Activity Monitoring

100

The jbpm-bam module contains an event listener that

stores process-related information in a database using JPA

or Hibernate directly.

The data model itself contains three entities, one for

process instance information, one for node instance

information, and one for (process) variable instance

information.

JBPM5

Modelo de datos del BAM

101

JBPM5

BAM – Tabla ProcessInstanceLog

102

JBPM5

BAM – Tabla NodeInstanceLog

103

JBPM5

BAM – Tabla VariableInstanceLog

104

JBPM5

9. Conclusiones

Oscar Vásquez Flores

eoscarvf@gmail.com

2013-03-28

106

JBPM5

Objetivos

Conclusiones

107

JBPM5

Soporte

108

http://docs.jboss.org/jbpm/v5.4/userguide/

http://docs.jboss.org/jbpm/v5.4/javadocs/

http://www.jboss.org/jbpm/

top related