introducing workflow architectures using grails - greach 2015

59
10th April 2015 Introducing Workflow Architectures USING GRAILS Rubén Mondéjar Diputació de Tarragona Rubén Mondéjar Diputació de Tarragona

Upload: ruben-mondejar-andreu

Post on 21-Jul-2015

594 views

Category:

Software


2 download

TRANSCRIPT

Page 1: Introducing Workflow Architectures Using Grails - Greach 2015

10th April 2015

Introducing Workflow Architectures

USING GRAILS

Rubén MondéjarDiputació de Tarragona

Rubén MondéjarDiputació de Tarragona

Page 2: Introducing Workflow Architectures Using Grails - Greach 2015

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]

Page 3: Introducing Workflow Architectures Using Grails - Greach 2015

Outline

(1) From BPM to Grails

(2) Dev-Friendly BPM

(3) Extending BPMS

(4) Injecting BPM

Page 4: Introducing Workflow Architectures Using Grails - Greach 2015

From BPM to GrailsA TRUE STORY

1

Page 5: Introducing Workflow Architectures Using Grails - Greach 2015

“Everything looks interesting until you do it. Then you find it's just another job.”

Terry PratchettMoving PicturesDiscworld 10th Novel

Quote

Page 6: Introducing Workflow Architectures Using Grails - Greach 2015

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

Page 7: Introducing Workflow Architectures Using Grails - Greach 2015

Processes

Page 8: Introducing Workflow Architectures Using Grails - Greach 2015

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

Page 9: Introducing Workflow Architectures Using Grails - Greach 2015

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

Page 10: Introducing Workflow Architectures Using Grails - Greach 2015

3-Tier Architecture

Client Tier

Logic Tier

Data Tier

SQL SearchEngine NoSQL (...)

(...)Web Framework

Web Framework (...) (...)(...)

Page 11: Introducing Workflow Architectures Using Grails - Greach 2015

3-Tier Architecture

SQL SearchEngine NoSQL (...)

(...)Web Framework

Web Framework

Web Framework

Workflow System

(...) (...)(...)

Client Tier

Logic Tier

Data Tier

Page 12: Introducing Workflow Architectures Using Grails - Greach 2015

App

Scenario

AppApp

AppApplication

DB

ProcProc

ProcProc

ProcWorkflow

Web Framework Workflow System

Page 13: Introducing Workflow Architectures Using Grails - Greach 2015

App

Scenario

AppApp

AppApplication

ProcProc

ProcProc

ProcWorkflow

CONTROL FLOW

Web Framework

Page 14: Introducing Workflow Architectures Using Grails - Greach 2015

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

Page 15: Introducing Workflow Architectures Using Grails - Greach 2015

Models

● Graphical representation of a business process

● Consists of simple diagrams constructed from a limited set of element shapes

Page 16: Introducing Workflow Architectures Using Grails - Greach 2015

Models

Activity

EventSequence flow

Gateway

Page 17: Introducing Workflow Architectures Using Grails - Greach 2015

BPMN

Events

Page 18: Introducing Workflow Architectures Using Grails - Greach 2015

Activities

● Principle: not all tasks can be automated

● First step, identify each type

Automated User

21

Manual

3

Page 19: Introducing Workflow Architectures Using Grails - Greach 2015

Tasks

Automated

Outside

BPMN markers

Inside

Interactive

Page 20: Introducing Workflow Architectures Using Grails - Greach 2015

Vacation Example

Page 21: Introducing Workflow Architectures Using Grails - Greach 2015

Vacation Example

start > flow1 > task1 > flow2 > xor > flow3 > task2 > flow 4 > end1

Page 22: Introducing Workflow Architectures Using Grails - Greach 2015

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>

Page 23: Introducing Workflow Architectures Using Grails - Greach 2015

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

Page 24: Introducing Workflow Architectures Using Grails - Greach 2015

Solutions

Pure BPMN Grails Plugins

● jBPM Plugin

● Activiti Plugin

● Camunda Plugin

Page 25: Introducing Workflow Architectures Using Grails - Greach 2015

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

Page 26: Introducing Workflow Architectures Using Grails - Greach 2015

Developer-FriendlyBUSINESS PROCESS MANAGEMENT

2

Page 27: Introducing Workflow Architectures Using Grails - Greach 2015

Motivation

if ( large and complex and monolithic ) {

}

Page 28: Introducing Workflow Architectures Using Grails - Greach 2015

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

Page 29: Introducing Workflow Architectures Using Grails - Greach 2015

Workflow Engine

Embedded (local services)

Remote(remote services)

Page 30: Introducing Workflow Architectures Using Grails - Greach 2015

Engine Services

Workflow Engine

RepositoryService

RuntimeService ManagementService HistoryService

TaskService IdentityService FormService

(...)

Page 31: Introducing Workflow Architectures Using Grails - Greach 2015

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]

Page 32: Introducing Workflow Architectures Using Grails - Greach 2015

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]

Page 33: Introducing Workflow Architectures Using Grails - Greach 2015

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]

Page 34: Introducing Workflow Architectures Using Grails - Greach 2015

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]

Page 35: Introducing Workflow Architectures Using Grails - Greach 2015

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]

Page 36: Introducing Workflow Architectures Using Grails - Greach 2015

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]

Page 37: Introducing Workflow Architectures Using Grails - Greach 2015

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]

Page 38: Introducing Workflow Architectures Using Grails - Greach 2015

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

Page 39: Introducing Workflow Architectures Using Grails - Greach 2015

Extending BPMSOCELOT PROJECT

3

Page 40: Introducing Workflow Architectures Using Grails - Greach 2015

Let’s Build

Page 41: Introducing Workflow Architectures Using Grails - Greach 2015

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

Page 42: Introducing Workflow Architectures Using Grails - Greach 2015

ArchitectureDeveloper-Friendly BPM

Page 43: Introducing Workflow Architectures Using Grails - Greach 2015

ArchitectureDeveloper-Friendly BPM

MicroServices Architecture

Page 44: Introducing Workflow Architectures Using Grails - Greach 2015

Implementation

Page 45: Introducing Workflow Architectures Using Grails - Greach 2015

Ocelot BPMS

Page 46: Introducing Workflow Architectures Using Grails - Greach 2015

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.

Page 47: Introducing Workflow Architectures Using Grails - Greach 2015

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

Page 48: Introducing Workflow Architectures Using Grails - Greach 2015

Demo Time

Ocelot XE(5 minutes)

Source : https://github.com/Ocelot-BPMS/

Page 49: Introducing Workflow Architectures Using Grails - Greach 2015

Injecting BPMABOUT INTEGRATION

4

Page 50: Introducing Workflow Architectures Using Grails - Greach 2015

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?

Page 51: Introducing Workflow Architectures Using Grails - Greach 2015

Explicit BPM

External Services

● The aim of integration is to reach the other side of BPMS

Page 52: Introducing Workflow Architectures Using Grails - Greach 2015

● The aim of integration is to reach the other side of BPMS

● Detailed Knowledge + Behaviour Modification

Explicit BPM

External Services

param:taskId

callbackUrl

Page 53: Introducing Workflow Architectures Using Grails - Greach 2015

Implicit BPM● What about taking advantage of the MVC pattern to

acquire knowledge and change the behaviour in runtime?

Page 54: Introducing Workflow Architectures Using Grails - Greach 2015

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

Page 55: Introducing Workflow Architectures Using Grails - Greach 2015

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

Page 56: Introducing Workflow Architectures Using Grails - Greach 2015

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

Page 57: Introducing Workflow Architectures Using Grails - Greach 2015

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

Page 58: Introducing Workflow Architectures Using Grails - Greach 2015

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)

Page 59: Introducing Workflow Architectures Using Grails - Greach 2015

10th April 2015

THANKS!

Rubén MondéjarDiputació de Tarragona

Rubén MondéjarDiputació de Tarragona