4. 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
5. 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
6. 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
10. 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
11. 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
31. 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
35. 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
36. 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/
39. 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
46. 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
62. 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
64. 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
65. 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
66. 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
67. 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
68. 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
69. 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
71. 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
79. 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
86. 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
87. 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
100. JBPM5
BusinessActivity 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.