Curso de JBPM5

1,588 views
1,474 views

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,588
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
56
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Curso de JBPM5

  1. 1. 1
  2. 2. JBPM5 1. Introducción Oscar Vásquez Flores eoscarvf@gmail.com 2013-03-28 2
  3. 3. JBPM5 Objetivos  Presentar al producto JBPM5 y su contexto. 3
  4. 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. 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. 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
  7. 7. JBPM5 jBPM de JBoss 7
  8. 8. JBPM5 Soluciones de Red Hat 8
  9. 9. JBPM5 Componentes de JBPM Core engine Eclipse plugins Web Designer Console Otros 9
  10. 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. 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
  12. 12. JBPM5 jBPM Eclipse plugin. 12 Solo sirve como herramienta BPMN2 No sirve como herramienta a JBPM5
  13. 13. JBPM5 jBPM Web Designer. 13 Herramienta de diseño de procesos recomendada por JBPM5
  14. 14. JBPM5 jBPM Console 14
  15. 15. JBPM5 Otros componentes de jBPM. * Human task service. * Process repository. * History log. * Form builder. * 15
  16. 16. JBPM5 Arquitectura de jBPM 16
  17. 17. JBPM5 Actividades 17  Realizar el Laboratorio 1: Conceptos relacionados a JBPM.
  18. 18. JBPM5 Oscar Vásquez Flores eoscarvf@gmail.com 2013-03-28 18 2. Preparando el ambiente
  19. 19. JBPM5 Objetivos  Preparar el ambiente de trabajo con JBPM5 19
  20. 20. JBPM5 Instalador de JBPM5 http://sourceforge.net/projects/jbpm/files/ 20
  21. 21. JBPM5 JBPM5 versión 5.4 21
  22. 22. JBPM5 Archivos de instalación de JBPM5 22
  23. 23. JBPM5 Instalador del JBPM5 Web Process Designer http://sourceforge.net/projects/jbpm/files/ 23
  24. 24. JBPM5 24 Instalador del JBPM5 Web Process Designer
  25. 25. JBPM5 Ejemplo de ambiente en desarrollo 25 Local file BD Repositorio (H2) JBPM5 Repositorio de usuarios Repositorio interno JBOSS7
  26. 26. JBPM5 Ejemplo de ambiente en producción 26 LDAP (Apache DS) BD Repositorio (Postgresql) JBPM5 Repositorio de usuarios Repositorio interno JBOSS7
  27. 27. JBPM5 Actividades 27  Realizar el Laboratorio 2: Preparando el ambiente de desarrollo
  28. 28. JBPM5 3. Plugins de Eclipse para JBPM Oscar Vásquez Flores eoscarvf@gmail.com 2013-03-28 28
  29. 29. JBPM5 Objetivos  Mostrar las opciones de integración de JBPM con Eclipse. 29
  30. 30. JBPM5 Opciones de Plugin para Eclipse I. JBPM Eclipse plugin II. Eclipse BPMN 2.0 plugin 30
  31. 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
  32. 32. JBPM5 I. JBPM Eclipse plugin 32
  33. 33. JBPM5 I. JBPM Eclipse plugin – Integración con Drools Guvnor 33
  34. 34. JBPM5 I. JBPM Eclipse plugin – Integración con Drools Guvnor 34
  35. 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. 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/
  37. 37. JBPM5 Drools Guvnor – Gestión de assets 37
  38. 38. JBPM5 Drools Guvnor – Exploración de assets 38
  39. 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
  40. 40. JBPM5 II. Eclipse BPMN 2.0 plugin 40
  41. 41. JBPM5 Soporte a BPMN2 durante el diseño de procesos 41 Especificación BPMN2 Eclipse BPMN2 Plugin JBPM Eclipse Plugin JBPM Web Designer
  42. 42. JBPM5 Actividades 42  Realizar el Laboratorio 3: Plugins de Eclipse para JBPM
  43. 43. JBPM5 4. Web Process Designer Oscar Vásquez Flores eoscarvf@gmail.com 2013-04-02 43
  44. 44. JBPM5 Objetivos  Conocer al jBPM Web Process Designer 44
  45. 45. JBPM5 jBPM5 Web Process Designer 45 http://localhost:8080/drools-guvnor
  46. 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
  47. 47. JBPM5 Drools Guvnor – Creación de un proceso de negocio 47
  48. 48. JBPM5 Drools Guvnor – Creación de un proceso de negocio 48
  49. 49. JBPM5 Drools Guvnor – Edición de proceso de negocio 49
  50. 50. JBPM5 Drools Guvnor – Servicio de repositorio para nodos 50
  51. 51. JBPM5 Drools Guvnor – Organización de assets 51
  52. 52. JBPM5 Drools Guvnor – Atributos del asset 52
  53. 53. JBPM5 Drools Guvnor – Versionamiento del asset 53
  54. 54. JBPM5 Drools Guvnor – Eliminar un asset 54
  55. 55. JBPM5 Drools Guvnor – Subir definición de clases 55
  56. 56. JBPM5 Drools Guvnor – Subir definición de clases 56
  57. 57. JBPM5 Drools Guvnor – Creación de paquetes 57
  58. 58. JBPM5 Actividades 58  Realizar el Laboratorio 4: Web Process Designer
  59. 59. JBPM5 5. El API Java para JBPM Oscar Vásquez Flores eoscarvf@gmail.com 2013-03-28 59
  60. 60. JBPM5 Objetivos  Conocer el API Java para JBPM 60
  61. 61. JBPM5 El JavaAPI.  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
  62. 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
  63. 63. JBPM5 Clase KnowledgeBase - Ejemplo KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add(ResourceFactory.newClassPathResource("TestProcess.bpmn"), ResourceType.BPMN2); KnowledgeBase kbase = kbuilder.newKnowledgeBase(); 63
  64. 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. 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. 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. 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. 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. 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
  70. 70. JBPM5 Invocación a un proceso – Diseño de proceso local 70
  71. 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
  72. 72. JBPM5 Invocación a un proceso – Proceso en Guvnor 72
  73. 73. JBPM5 Invocación a un proceso – Paquete en Guvnor 73
  74. 74. JBPM5 Jars necesarios – Propios de JBPM 74
  75. 75. JBPM5 Jars necesarios – Externos a JBPM 75 . . .
  76. 76. JBPM5 Actividades 76  Realizar el Laboratorio 5: El API Java para JBPM
  77. 77. JBPM5 6. JBPM Console Oscar Vásquez Flores eoscarvf@gmail.com 2013-04-02 77
  78. 78. JBPM5 Objetivos  Conocer el JBPM Console. 78
  79. 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
  80. 80. JBPM5 JBPM Console JBPM Console JBPM Console Server 80 Task Server Drools Guvnor Usuario jbpm-gwt-console-server.war jbpm-gwt-console.war
  81. 81. JBPM5 JBPM Console - Procesos 81
  82. 82. JBPM5 JBPM Console - Tareas 82
  83. 83. JBPM5 JBPM Console - Reportes 83
  84. 84. JBPM5 Configuración del JBPM Console * jbpm-gwt-console-server.war * jbpm.console.properties 84
  85. 85. JBPM5 Gestión de seguridad * {Path}jboss-as-7.1.1.Finalstandaloneconfiguration * users.properties 85 * roles.properties
  86. 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. 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
  88. 88. JBPM5 Interface REST de la JBPM Console 88
  89. 89. JBPM5 Actividades 89  Realizar el Laboratorio “JBPM Console”
  90. 90. JBPM5 7. Human task Oscar Vásquez Flores eoscarvf@gmail.com 2013-03-28 90
  91. 91. JBPM5 Objetivos  Revisar los temas relacionados a las tareas humanas. 91
  92. 92. JBPM5 kcontext 92
  93. 93. JBPM5 Propiedades del User Task 93
  94. 94. JBPM5 Propiedades del User Task - Content 94 map map = new java.util.HashMap(); map.put("namez","John Doe"); map.put("phoneNumber","123456789");
  95. 95. JBPM5 Propiedades del User Task – Formulario asociado 95
  96. 96. JBPM5 Propiedades del User Task - Assignments 96 Variables
  97. 97. JBPM5 Actividades 97  Realizar el Laboratorio 07: Tareas humanas
  98. 98. JBPM5 8. Business Activity Monitoring Oscar Vásquez Flores eoscarvf@gmail.com 2013-03-28 98
  99. 99. JBPM5 Objetivos  Business Activity Monitoring 99
  100. 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.
  101. 101. JBPM5 Modelo de datos del BAM 101
  102. 102. JBPM5 BAM – Tabla ProcessInstanceLog 102
  103. 103. JBPM5 BAM – Tabla NodeInstanceLog 103
  104. 104. JBPM5 BAM – Tabla VariableInstanceLog 104
  105. 105. JBPM5 Actividades 105  No existen.
  106. 106. JBPM5 9. Conclusiones Oscar Vásquez Flores eoscarvf@gmail.com 2013-03-28 106
  107. 107. JBPM5 Objetivos  Conclusiones 107
  108. 108. JBPM5 Soporte 108 http://docs.jboss.org/jbpm/v5.4/userguide/ http://docs.jboss.org/jbpm/v5.4/javadocs/ http://www.jboss.org/jbpm/

×