Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Introducing Workflow Architectures Using Grails - Greach 2015

4,161 views

Published on

Following new trends, as microservices architecture style and developer-friendly BPM solutions, we want to present our active open source projects using Grails

Published in: Software

Introducing Workflow Architectures Using Grails - Greach 2015

  1. 1. 10th April 2015 Introducing Workflow Architectures USING GRAILS Rubén Mondéjar Diputació de Tarragona Rubén Mondéjar Diputació de Tarragona
  2. 2. About Me twitter : @Ruuben4 homepage : http://deim.urv.cat/~ruben.mondejar Working ● Groovy & Grails ● Dev-Friendly BPM ● ITIL v3 / ISO 20000 Teaching / Research ● Software Architectures ● Web Development ● Distributed Systems [BPM RoundTable Tarragona]
  3. 3. Outline (1) From BPM to Grails (2) Dev-Friendly BPM (3) Extending BPMS (4) Injecting BPM
  4. 4. From BPM to Grails A TRUE STORY 1
  5. 5. “Everything looks interesting until you do it. Then you find it's just another job.” Terry Pratchett Moving Pictures Discworld 10th Novel Quote
  6. 6. Motivation ● Starting point: building software architectures which involves business processes ● Applications perform the expected behaviour, but implemented with different strategies ● For example, how to handle the data-flow or to address integration
  7. 7. Processes
  8. 8. Processes Collection of related events, activities, and decisions, that involve a number of actors and resources, and that collectively lead to an outcome that is of value to an organization or its customers Dumas, La Rosa, Mendling, Reijers, 2013
  9. 9. Key Concepts ● BPM (Business Process Management) is a discipline to automate organizational processes ● BPMS (... System) is a software architecture composed by different components that allow to build and integrate BPM and applications ● BPMN (... Notation) is a standard collection of rules and graphical shapes for drawing process models BPM BPMNBPMS
  10. 10. 3-Tier Architecture Client Tier Logic Tier Data Tier SQL Search Engine NoSQL (...) (...)Web Framework Web Framework (...) (...)(...)
  11. 11. 3-Tier Architecture SQL Search Engine NoSQL (...) (...)Web Framework Web Framework Web Framework Workflow System (...) (...)(...) Client Tier Logic Tier Data Tier
  12. 12. App Scenario App App App Application DB Proc Proc Proc Proc Proc Workflow Web Framework Workflow System
  13. 13. App Scenario App App App Application Proc Proc Proc Proc Proc Workflow CONTROL FLOW Web Framework
  14. 14. Control Flow ● Defines what to do and when ● A successor list among activities and events ● Main information represented in process models A B C D
  15. 15. Models ● Graphical representation of a business process ● Consists of simple diagrams constructed from a limited set of element shapes
  16. 16. Models Activity EventSequence flow Gateway
  17. 17. BPMN Events
  18. 18. Activities ● Principle: not all tasks can be automated ● First step, identify each type Automated User 21 Manual 3
  19. 19. Tasks Automated Outside BPMN markers Inside Interactive
  20. 20. Vacation Example
  21. 21. Vacation Example start > flow1 > task1 > flow2 > xor > flow3 > task2 > flow 4 > end1
  22. 22. BPMN.XML <definitions ...> <process id="example" name="Vacation Example"> <startEvent id="start"/> <sequenceFlow id="flow1" sourceRef="start" targetRef="task1"/> <userTask id="task1" name="Handle vacation request" bpmn:formKey="/vacation/handle" bpmn:candidateGroups="managers"> </userTask> <sequenceFlow id="flow2" sourceRef="task1" targetRef="xor"/> <exclusiveGateway id="xor"/> <sequenceFlow id="flow3" sourceRef="xor" targetRef="task2"> <conditionExpression>${approved}</conditionExpression> </sequenceFlow> <serviceTask id="task2" name="Send confirmation e-mail"/> <sequenceFlow id="flow4" sourceRef="task2" targetRef="end1"/> <endEvent id="end1" /> (...) </process> </definitions>
  23. 23. Solutions 1. Pure BPMN: designed from the ground up to follow the spec to the letter • jBPM, Activiti, Camunda 2. Adapted BPMN: use a BPMN skin but rely on internal representation • BonitaSoft, Bizagi, Intalio 3. Non BPMN: proprietary language and semantics • BPMOne, YAWL, GrailsFlow
  24. 24. Solutions Pure BPMN Grails Plugins ● jBPM Plugin ● Activiti Plugin ● Camunda Plugin
  25. 25. Plugin Usage 1. Quick start : grails create-process com.greach.TestProcess http://plexiti.github.io/camunda-grails-plugin/guide/usage.html#script-create-process 2. Easy configuration : plugins { compile ":camunda:0.4.0" } http://plexiti.github.io/camunda-grails-plugin/guide/configuration.html 3. Nice testing : grails test-app integration: com.greach.TestProcess http://plexiti.github.io/camunda-grails-plugin/guide/testing.html
  26. 26. Developer-Friendly BUSINESS PROCESS MANAGEMENT 2
  27. 27. Motivation if ( large and complex and monolithic ) { }
  28. 28. Dev-Friendly BPM ● Leaves behind the Zero-Code Myth ○ Previous and extended BPM solutions ○ Sandboxing of processes in a suite ● Fits with MicroService Architectures ○ Enable workflow execution into existing applications ○ Embedded or remote execution modes
  29. 29. Workflow Engine Embedded (local services) Remote (remote services)
  30. 30. Engine Services Workflow Engine RepositoryService RuntimeService ManagementService HistoryService TaskService IdentityService FormService (...)
  31. 31. Repository Service ● Naturally, it is the first service that we need ● Manages deployments and process definitions (BPMN) ● It can also activate or suspend specific deployments or process definitions RepositoryService RuntimeService ManagementService HistoryService TaskService IdentityService FormService Keywords: [BPMN] [Process Definition] [Deployment]
  32. 32. Runtime Service ● Deals with starting new process instances ● Starts a new process instance in the latest version of its process definition ● Retrieves all the visible variables from the given execution RepositoryService RuntimeService ManagementService HistoryService TaskService IdentityService FormService Keywords: [Versions] [Process Instance] [Variables]
  33. 33. Task Service ● Querying and modifying tasks assigned to the participants : users or groups ● Claiming a task for a specific participant ● Saving or completing a task, typically after filling the fields of a form RepositoryService RuntimeService ManagementService HistoryService TaskService IdentityService FormService Keywords: [Participants] [Claim] [Save] [Complete]
  34. 34. Management Service ● Allows metadata information retrieval ● Exposes query capabilities and management operations for jobs ● Used by the engine to handle timers, asynchronous continuations, or delayed suspension/activation RepositoryService RuntimeService ManagementService HistoryService TaskService IdentityService FormService Keywords: [Metadata] [Jobs] [Timers]
  35. 35. Identify Service ● Manage users and groups, but does not do any checking at runtime ● Tasks could be assigned to any user, but the engine does not verify if that user is known to the system ● Synchronization mechanisms are needed RepositoryService RuntimeService ManagementService HistoryService TaskService IdentityService FormService Keywords: [Users] [Groups] [Synchronization]
  36. 36. History Service ● Exposes query capabilities to access historical data ● Log level configuration allows the engine to keep the necessary data, like which tasks were performed by whom ● Allows finding all historical variable values from any given process in each of its executed tasks RepositoryService RuntimeService ManagementService HistoryService TaskService IdentityService FormService Keywords: [Historical data] [Execution logs] [Variables]
  37. 37. Form Service ● Start form is displayed to the user before the process instance is created ● Task form is displayed when a user has to work with an assigned task RepositoryService RuntimeService ManagementService HistoryService TaskService IdentityService FormService Keywords: [Start form] [Task form] [Form key] [Form data]
  38. 38. Form Service ● A form key is used to find the view that has to be rendered RepositoryService RuntimeService ManagementService HistoryService TaskService IdentityService FormService Keywords: [Start form] [Task form] [Form key] [Form data] ● Alternatively, a form data can be defined in the BPMN 2.0 process definition using a proper extension
  39. 39. Extending BPMS OCELOT PROJECT 3
  40. 40. Let’s Build
  41. 41. Components ● Modeling tool: creates and modifies executable workflow models ● Execution Engine: instantiates executable workflow models ● Worklist Handler: or “inbox”, offers tasks to workflow participants ● Administration tools: manage, monitor, and automate the entire workflow system
  42. 42. Architecture Developer-Friendly BPM
  43. 43. Architecture Developer-Friendly BPM MicroServices Architecture
  44. 44. Implementation
  45. 45. Ocelot BPMS
  46. 46. Modeling Tool (MT) ● Based on BPMN.io and Grails ● REST API : Export BPMN models to XML / SVG ● Main goal : customization ● Custom Palette ○ Different frequency-based profiles ○ User reconfiguration ● Custom Tasks ○ Create new task types ○ Phone calls, Signatures, Approvals, Archiving, Feedback Survey, etc.
  47. 47. eXecution Environment (XE) ● Based on Camunda and Grails ● REST Client : Importing Models (from diff. env.) ● Main goal : upper layer ○ Workflow Service : Unifying and extending the process engine services with aggregated methods ○ REST API : allowing remote access ● Render forms ○ Scaffolded : formData ○ External : formKey
  48. 48. Demo Time Ocelot XE (5 minutes) Source : https://github.com/Ocelot-BPMS/
  49. 49. Injecting BPM ABOUT INTEGRATION 4
  50. 50. Conclusions ● Dev-Friendly BPM : nicest way to build workflow architectures in Grails ● Extending BPMS : implementing workflow applications or microservices with Grails ● Integration with BPM : … wait! explicitly or implicitly?
  51. 51. Explicit BPM External Services ● The aim of integration is to reach the other side of BPMS
  52. 52. ● The aim of integration is to reach the other side of BPMS ● Detailed Knowledge + Behaviour Modification Explicit BPM External Services param:taskId callbackUrl
  53. 53. Implicit BPM ● What about taking advantage of the MVC pattern to acquire knowledge and change the behaviour in runtime?
  54. 54. Example Pet Store (MVC Application, UML)1 Success Page Item List Page Show Page search shopping cart add item checkoutcheckout Order Home Page Find Item Confirm Cart Process Order Book Balance Save Purchase 3 Handle Purchase Register Customer Payment? customer? init completed done verified wrong regular new Purchase Workflow (Business Process Model, BPMN 2.0) cancelled Accounting (MVC Application, UML)2 Book Customer newcustomer manage books Main Page Show Page List Page Create Customer Edit Book
  55. 55. Example Book Balance Pet Store (MVC Application, UML) Save Purchase 1 Accounting (MVC Application, UML)2 3 Handle Purchase Register Customer Payment? customer? init completed done verified wrong regular new Success Page Item Book Customer List Page Show Page search shopping cart add item checkoutcheckout Order newcustomer manage books Purchase Workflow (Business Process Model, BPMN 2.0) Home Page Main Page Show Page List Page Create Customer Edit Book Find Item Confirm Cart Process Order A trigger B render C find sets D perform E perform cancelled
  56. 56. PurchaseWorkflow { in PetStore : During ”process” action from Order, trigger ”init” event After ”Save Purchase” task, render ”success” view in Accounting : Before ”Book Balance” task, find ”customer” domain by ”nin” and sets ”exists” attribute After ”Book Balance” task, perform ”update” action from Book After ”Register Customer” task, perform ”create” action from Customer } DSL A B C D E Workflow Weaving
  57. 57. Code MVC Framework Container Instance Weaver Proxies Reflection Capabilities AOP Facilities Implicit BPM Plugin Implicit BPM Back-End Workflow Engine Weaver Repository Workflow Database Weaver Coordinator Platform Manager DSL Interpreter BPMN Parser A Application (A) B C E D MicroServices Architecture Architecture
  58. 58. More Info ● Website : http://implicit-bpm.sf.net ● Source code : http://sf.net/p/implicit-bpm/code ● Research paper : Implicit BPM: a Business Process Platform for Transparent Workflow Weaving. Rubén Mondéjar, Pedro García-López, Carles Pairot, and Enric Brull. In: BPM, pp. 168–183 (2014)
  59. 59. 10th April 2015 THANKS! Rubén Mondéjar Diputació de Tarragona Rubén Mondéjar Diputació de Tarragona

×