Activiti: Difference between revisions

From Wiki RB4
Line 86: Line 86:
  C:\Uwes\java\activiti\5.0\setup\ant (default target is '''demo.start''') starts h2-DB on port 9092 and tomcat on port 8099.  
  C:\Uwes\java\activiti\5.0\setup\ant (default target is '''demo.start''') starts h2-DB on port 9092 and tomcat on port 8099.  
Other targets are '''tomcat.start''', '''tomcat.stop''', '''h2.start''', '''h2.stop''', '''db.drop''', '''db.create'''.
Other targets are '''tomcat.start''', '''tomcat.stop''', '''h2.start''', '''h2.stop''', '''db.drop''', '''db.create'''.
===Modeler===
* files are saved in C:\Uwes\java\Activiti\activiti-5.6\workspace\activiti-modeler-examples\


===Designer===
===Designer===

Revision as of 20:19, 18 June 2011

Introduction

The Activiti has a clear origin in the jBPM project of JBoss. The former lead developers of jBPM, Tom Baeyens and Joram Barrez, created a vibrant community around this process engine and they created a process virtual machine sub-project that enabled jBPM to be used for multiple process languages. At that point in time Alfresco was using jBPM in their document management system for the implementation of foremost workflow related functionality. But they were looking for a process engine with a more liberal open source license. ventually Alfresco decided to create a liberal Apache licensed open source process engine themselves and contacted Tom and Joram. Activiti was born! The Activiti project started off at a very fast pace and succeeded to do a monthly release of the tool stack until the stable 5.0 release in December 2010.

Activiti vs. jBMP

My personal impression is that Activiti seems much more the logical continuation of jBPM, then jBPM5 is. This article concludes that the opportunities of both BPMS are nearly identical.

Installation

  • extract activiti-5.6.zip to C:\Uwes\java\Activiti\activiti-5.6
  • C:\Uwes\java\Activiti\activiti-5.4\setup\ant demo.start
  • set CATALINA_HOME=C:\Uwes\java\Activiti\activiti-5.6\apps\apache-tomcat-6.0.32
  • download eclipse 3.6.2 (helios) and extract to C:\Uwes\eclipse\v362_classic\

Eclipse Plug-In

Ant targets

  • demo.start
  • deom.stop
  • tomcat.start
  • tomcat.stop
  • h2.start
  • h2.stop
  • db.drop
  • db.create

Documentation

Architecture

As Activiti is 'just a jar', it can be embedded in any Java environment: with swing or on a Tomcat, JBoss, WebSphere, etc. Or you could very well choose to run Activiti as a typical, standalone BPM server.

Components

see sheet Activiti

Eplorer

work item list

Probe

admin area, provides us with a web view on the database tables of the Activiti engine.

Kickstart

Adhoc workflows

Modeler

web base modeling tool

Designer

eclipse plugin modeling tool, started and maintained by Tijs Rademakers, Tiese Barrell, Ron van Liempd and Yvo Swillens. Enhancement of Modeler process definition to be executable. For Using see here.

Cycle

business it alignment

Script Languages

  • Groovy (standard)

Standards

BPMN XML

API

The Activiti Engine API is divided into seven core interfaces, which are each targeted at interacting with different functionality of the process engine.

  • FormService
  • HistoryService
  • IdentityService
  • ManagementService
  • RepositoryService
  • RuntimeService
  • TaskService

RuntimeService

createStandaloneInMemProcessEngineConfiguration()
ProcessEngine processEngine = ProcessEngineConfiguration.
                              createStandaloneInMemProcessEngineConfiguration().
                              buildProcessEngine();

start a H2 in memory database.

createStandaloneProcessEngineConfiguration()
ProcessEngine processEngine = ProcessEngineConfiguration.
                              createStandaloneProcessEngineConfiguration().
                              buildProcessEngine();

uses a connection to a running H2 database.

Using Activiti

C:\Uwes\java\activiti\5.0\setup\ant (default target is demo.start) starts h2-DB on port 9092 and tomcat on port 8099. 

Other targets are tomcat.start, tomcat.stop, h2.start, h2.stop, db.drop, db.create.

Modeler

  • files are saved in C:\Uwes\java\Activiti\activiti-5.6\workspace\activiti-modeler-examples\


Designer

Activities

Script Tasks

All process variables are accessible by name in the script.

Service Tasks
public class CreateApplicationTask 
  implements org.activiti.engine.delegate.JavaDelegate
{ 
  @Override
  public void execute(DelegateExecution arg0) throws Exception
  {
    // has to implement Serializable
    Application app = new Application();
    // get process variable
    Boolean b = (Boolean) execution.getVariable("name"));
    // store process variable
    execution.setVariable("name", app);
  }
}

Create JUnit Test

  • right click diagram -> Activiti -> Create JUnit Test
  • process parameter can be defined by
Map<String, Object> vars = new HasMap<String, Object>();
vars.put("name", value);
runtimeService.startProcessInstanceByKey("diagram", vars);

Deployment

The so-called Business Archive (BAR) files are ZIP compressed files that contain processes and their dependencies, like forms, that can be deployed on the Activiti Engine. Deployment of a BAR file via:

  • Probe. Probe provides functionality to deploy new BAR files and to delete previous deployments.
  • Ant using the REST API.


Initial Tests

Eclipse based Tutorial

Pizza Tutorial

Blog

Didn't work because of missing class.

Eclipse Project 'ActivitiTest1'

  • start eclipse
  • File -> New -> Project -> Activiti Project
  • select /src/main/resources/diagrams
  • right mouse -> New -> Other -> Activiti diagram 'ActivitiTest1.Diagram1'
  • create ActivitiTest1TestCase1 in /src/test/java/
  • right mouse -> Run As -> JUnit

Configuration

Resources

  • C:\Uwes\Documents\Software_Development\Modeling\BusinessProcessModeling\BPM.vsd
  • C:\Uwes\Documents\Software_Development\Modeling\BusinessProcessModeling\Activiti\ActivitiInAction.pdf