A new kind of BPM with Activiti
Upcoming SlideShare
Loading in...5
×
 

A new kind of BPM with Activiti

on

  • 4,276 views

This session will demonstrate the Activiti tools in the context of the full software development cycle. Starting from business people over developers to system administrators. Activiti facilitates ...

This session will demonstrate the Activiti tools in the context of the full software development cycle. Starting from business people over developers to system administrators. Activiti facilitates the collaboration between those roles in a pragmatic and new way. For the developer part, we'll briefly dive a bit deeper. With code samples we'll give you a look under the hood.

Statistics

Views

Total Views
4,276
Slideshare-icon Views on SlideShare
4,276
Embed Views
0

Actions

Likes
3
Downloads
183
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    A new kind of BPM with Activiti A new kind of BPM with Activiti Presentation Transcript

    • A new kind of BPM with Activiti
      2
      Tom Baeyens & Joram Barrez
      Alfresco
      twitter: @tombaeyens @jbarrez
    • Tom Baeyens
      3
      • Founder of Activiti & jBPM
      • Passionate about Java and BPM
      • http://processdevelopments.blogspot.com/
      Joram Barrez
      • Ex-core developer JBossjBPM
      • Core developer Activiti
      • http://www.jorambarrez.be/
    • BPM for developers
      4
      • Process = Activities + Transitions
      • Activity = Execution step in your application
      • Configure out of the box activity types
      • User task
      • Email
      • Script
      • Web service
      • JMS
      • EJB
      • Delegate to Java& scripting where necessary
      • Timers
    • Activiti Engine
      5
      • Essence: State machine
      • Persist state of an execution flow
      Execution
      EmplJohn Doe
      Date 5/10/2010
      Doc vacation.xls
      State Approved
    • Transactional Control Flow
      6
      • Start process instance
      • Create new execution
      • Pass initial data in (optional)
      • Take transition to “Fetch data from DB”
      • Execute “Fetch data from DB”
      • Take transition to “Wait 1”
      • Stop interpreting process
      • Persist state
      • Return
      Execution
    • Transactional Control Flow
      7
      INSERT INTO ACT_RU_EXECUTION (…, ACTIVITY_ID_, …)
      values
      (…, ‘Wait’, …)
      Execution
    • Transactional Control Flow
      8
      • Signal
      • Load existing execution
      • Pass data in (optional)
      • Take transition to “Wait 2”
      • Stop interpreting process
      • Update runtime execution
      • Return
      Execution
    • Transactional Control Flow
      9
      UPDATE ACT_RU_EXECUTION SET ACTIVITY_ID = ‘Wait 2’
      Execution
    • Transactional Control Flow
      10
      • Signal
      • Load existing execution
      • Pass data in (optional)
      • Take transition to “Send email”
      • Execute “Send email”
      • Take transition to “end”
      • Stop interpreting process
      • Delete runtime execution
      • Return
      Execution
    • Transactional Control Flow
      11
      DELETE FROM ACT_RU_EXECUTION WHERE ID_ = ?
      Execution
    • Extra convenience in activity types
      12
      • Examples
      • Task lists
      • JMS message send & receive
      • Web service send & receive
      • And… everything you can do in Java
      • Activity pluggability
    • Extra convenience in history
      13
      • Optional, default turned on
      • Log every process instance and activity instance
      • Activities at business level
      • Statistics are valuable business intelligence
      • For FREE
    • Coming up
      14
      • How to implement a process with Activiti
      • Showing you the nitty-gritty details
      • Making you an Activiti-ninja-developer-hero
    • Demo
      15
      • Use case: banks shouldn’t lend money to just anybody
      • Thorough analysis is needed
      • All steps needs to be recorded in official documents
      • Decisions are done based on Excel decision tables
    • The mortgage process
      16
    • The mortgage process
      17
      = CMIS call
    • Deployment
      18
      • Collection of resources
      Deployment deployment = repositoryService
      .createDeployment()
      .addClasspathResource(“mortgage-process.bpmn20.xml”)
      .addInputStream(“mortgage.png”)
      .addZipInputStream(“mortgage-docs.zip”)

      Deployment
    • Deployment
      19
      • “Deploying”
      repositoryService
      .createDeployment()
      .addXXX()

      .deploy()
      bytes
      Activiti engine
      Mortgage process
      bpmn
      Deployment
      deployers
      ProcessDefinition
    • Process versioning
      20
      • Markets, customers, products, … change
      • Business processes change
      • Activiti supports versioned process definitions
      ProcessInstanceprocessInstanceA =
      runtimeService.startProcessInstanceByKey(“mortgage”);
      repositoryService.createDeployment()
      .addClasspathResource(“mortgage-process.bpmn20.xml”)
      .deploy();
      Process def “mortgage”, version = 1
      ProcessInstanceprocessInstanceB =
      runtimeService.startProcessInstanceByKey(“mortgage”);
      Process def “mortgage”, version = 2
    • Process versioning
      21
      • But what about existingprocess instances?
      • They execute according the original process definition
      • “Phase-out” strategy
      • New process instances
      • Default: latest deployed process definition
      • Instance migration
      runtimeService.startProcessInstanceByKey(“process-key”);
      ProcessDefinitionprocDef =
      repositoryService.createProcessDefinitionQuery()
      .name(“myProcess”)
      .version(2)
      .singleResult();
      runtimeService.startProcessInstanceById(procDef.getId());
      Latest deployed
      Specific version
    • Starting the process
      22
      • Programmatically
      BPMN start event
      ProcessInstanceprocessInstanceA =
      runtimeService.startProcessInstanceByKey(“myProces”);
    • Start form
      23
      • Processes often need data to run
      • Start event can have a start form to capture this data
      • Activiti Explorer
      FormInstance form = repositoryService.getStartFormInstance(“mortgage”);
    • Start form
      24
      • Activiti Explorer
      • Supports easy-to-build-and-understand HTML forms
    • User task
      25
      • Wait state
      • Creates a Task entry in the DB
    • Service task
      26
      • Call custom business logic
      • Support for
      • Delegation to class
      • Expressions (see later)
    • Service task
      27
      • Soon
      • Webservice support
    • Exclusive gateway
      28
      • Control flow
      • Selects 1 (and only 1) outgoing seq-flow based on the expressions
    • Mail task
      • Automatic step
      • Specific service task shipped with Activiti
      29
    • Unit testing your business processes
      • With Activiti, your business processes are an integral part of your software project
      • So they should be tested just the same as your regular application code …
      • With unit tests !
      • Activiti supports both JUnit 3 and JUnit4 style of testing your business processes
      • And ships with a lot of convience for testing
      • Demo
      30
      Pic from http://silverbackapp.com
    • The cool stuff
      • That didn’t make it into the demo
      • But is just too cool not to share with you
      • Timers
      • Script support
      • Query API
      • Spring integration
      • Method expressions
      • JPA
      31
    • Timers
      • Work is often time constrained
      • A timer boundary event can be attached
      to the boundary of any task or subprocess
      32
    • Timers
      • When timer fires
      • Current execution(s) inside scope of event are destroyed and process continues following seq-flow going out the timer event
      33
    • Script task
      • Execute a script embedded in the process definition
      • Any JSR-223 compliant script language
      • Opens up powerful capabilities
      • Javascript, XPath, CMIS-script (?)
      <scriptTask id="theScriptTask" name="Execute script" scriptFormat="groovy">  <script>    sum = 0    for (i in inputArray) {      sum += i    }
      execution.setVariable(“myVar”, sum)  </script></scriptTask>
      34
    • Query API
      • No need to learn the intern data model
      • Powerful and uniform query API
      • Deployments and process definitions
      • Process instances and executions
      • History
      • Variables
      • Tasks, jobs, users, groups, historic activities/process instances/variables, …
      repositoryService.createProcessDefinitionQuery.keyLike(“%mortgage%”).latest();
      runtimeService.createProcessInstanceQuery
      .processDefinitionKey(“mortgage-process)”.orderByProcessInstanceId().desc();
      historyService.createHistoricActivityQuery().processDefinitionId(procDefId)
      .activityType(“userTask”).orderByDuration().asc();
      runtimeService.createProcessInstanceQuery()
      .variableValueGreaterThan(“amount”, 50000);
      35
    • Spring integration
      • First-class integration with Spring
      • Define and inject Activiti process engine and services
      • Leverage and integrate with Spring transaction management
      • Delegate to Spring beans in the process definition
      • Resource deployment and duplicate filtering for simplified development
      • Spring unit testing support
      36
    • Spring integration
      • ProcessEngine as a Spring bean
      • Delegate to Spring beans
      <bean id=“printer” …
      37
    • Method expressions and JPA
      • Besides the typical expressions that everyone supports, Activiti has
      • method expressions
      • method parameters
      • Variables, execution, …
      • First-class JPA support
      • Store JPA entity as process variable
      • Seamless integration of domain model with process
      • Only domain model reference is stored
      • Fetch/update is done in original data store
      38
    • Throwing it all together
      Update JPA entity
      Decision based on
      JPA entity property
      Spring bean
      Process variables
      39
    • The Activiti Experience
      • Satisfy your Activiti itch
      • One-stop-shop download:
      • http://www.activiti.org
      • Demo: “The Activiti Experience”
      • Do you have an excuse for not trying out Activiti later today?
      40