10th April 2015 Introducing Workflow Architectures USING GRAILS Rubén Mondéjar Diputació de Tarragona Rubén Mondéjar Diputació de Tarragona
10th April 2015
Introducing Workflow Architectures
USING GRAILS
Rubén MondéjarDiputació de Tarragona
Rubén MondéjarDiputació de Tarragona
About Me
twitter : @Ruuben4homepage : 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]
Outline
(1) From BPM to Grails
(2) Dev-Friendly BPM
(3) Extending BPMS
(4) Injecting BPM
From BPM to GrailsA TRUE STORY
1
“Everything looks interesting until you do it. Then you find it's just another job.”
Terry PratchettMoving PicturesDiscworld 10th Novel
Quote
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
Processes
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
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
3-Tier Architecture
Client Tier
Logic Tier
Data Tier
SQL SearchEngine NoSQL (...)
(...)Web Framework
Web Framework (...) (...)(...)
3-Tier Architecture
SQL SearchEngine NoSQL (...)
(...)Web Framework
Web Framework
Web Framework
Workflow System
(...) (...)(...)
Client Tier
Logic Tier
Data Tier
App
Scenario
AppApp
AppApplication
DB
ProcProc
ProcProc
ProcWorkflow
Web Framework Workflow System
App
Scenario
AppApp
AppApplication
ProcProc
ProcProc
ProcWorkflow
CONTROL FLOW
Web Framework
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
Models
● Graphical representation of a business process
● Consists of simple diagrams constructed from a limited set of element shapes
Models
Activity
EventSequence flow
Gateway
BPMN
Events
Activities
● Principle: not all tasks can be automated
● First step, identify each type
Automated User
21
Manual
3
Tasks
Automated
Outside
BPMN markers
Inside
Interactive
Vacation Example
Vacation Example
start > flow1 > task1 > flow2 > xor > flow3 > task2 > flow 4 > end1
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>
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
Solutions
Pure BPMN Grails Plugins
● jBPM Plugin
● Activiti Plugin
● Camunda Plugin
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
Developer-FriendlyBUSINESS PROCESS MANAGEMENT
2
Motivation
if ( large and complex and monolithic ) {
}
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
Workflow Engine
Embedded (local services)
Remote(remote services)
Engine Services
Workflow Engine
RepositoryService
RuntimeService ManagementService HistoryService
TaskService IdentityService FormService
(...)
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]
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]
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]
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]
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]
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]
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]
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
Extending BPMSOCELOT PROJECT
3
Let’s Build
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
ArchitectureDeveloper-Friendly BPM
ArchitectureDeveloper-Friendly BPM
MicroServices Architecture
Implementation
Ocelot BPMS
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.
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
Demo Time
Ocelot XE(5 minutes)
Source : https://github.com/Ocelot-BPMS/
Injecting BPMABOUT INTEGRATION
4
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?
Explicit BPM
External Services
● The aim of integration is to reach the other side of BPMS
● The aim of integration is to reach the other side of BPMS
● Detailed Knowledge + Behaviour Modification
Explicit BPM
External Services
param:taskId
callbackUrl
Implicit BPM● What about taking advantage of the MVC pattern to
acquire knowledge and change the behaviour in runtime?
ExamplePet Store (MVC Application, UML)1
Success Page
Item ListPage
ShowPage
search
shoppingcart
add item
checkoutcheckout
Order
Home Page
FindItem
ConfirmCart
ProcessOrder
Book Balance
SavePurchase
3
HandlePurchase
Register Customer
Payment?
customer?
init completed
done
verified
wrongregular
new
Purchase Workflow (Business Process Model, BPMN 2.0)cancelled
Accounting (MVC Application, UML)2
Book
Customer
new customer
manage
books
Main Page Show
Page
List Page
CreateCustomer
EditBook
Example
Book Balance
Pet Store (MVC Application, UML)
SavePurchase
1 Accounting (MVC Application, UML)2
3
HandlePurchase
Register Customer
Payment?
customer?
init completed
done
verified
wrongregular
new
Success Page
Item Book
Customer
ListPage
ShowPage
search
shoppingcart
add item
checkoutcheckout
Order
new customer
manage
books
Purchase Workflow (Business Process Model, BPMN 2.0)
Home Page
Main Page Show
Page
List Page
CreateCustomer
EditBook
FindItem
ConfirmCart
ProcessOrder
Atrigger
Brender C
findsets
D
perform
Eperform
cancelled
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
Code
MVCFramework
Container
Instance
WeaverProxies
ReflectionCapabilities
AOPFacilities
Implicit BPMPlugin
Implicit BPM Back-End
WorkflowEngine
WeaverRepository
WorkflowDatabase
WeaverCoordinator
Platform Manager
DSLInterpreter
BPMNParser
A
Application (A)
B
C E
D
MicroServicesArchitecture
Architecture
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)
10th April 2015
THANKS!
Rubén MondéjarDiputació de Tarragona
Rubén MondéjarDiputació de Tarragona