Activiti

From Wiki RB4

Introduction[edit]

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. Alfresco is using jBPM and Activiti as process engine, but jBPM may be deprecated at some point in time.

Activiti vs. jBMP[edit]

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[edit]

  • extract activiti-5.9.zip to C:\Uwes\java\Activiti\activiti-5.10
  • C:\Uwes\java\Activiti\activiti-5.10\setup\ant demo.start
  • set CATALINA_HOME=C:\Uwes\java\Activiti\activiti-5.10\apps\apache-tomcat-6.0.32
  • replace 8080 in \setup\build.xml and <CATALINA_HOME>\conf\server.xml to 8079
  • download eclipse 3.6.2 (helios) and extract to C:\Uwes\eclipse\v362_classic\

Eclipse Plug-In[edit]

Ant targets[edit]

to be executed in <ACTIVITI_HOME>/setup

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

Documentation[edit]

Architecture[edit]

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[edit]

see sheet Activiti

Eplorer[edit]

  • work item list
  • start processes
  • dive into DB tables
  • overview of deployed processes

REST[edit]

Web application, which starts the process engine and a REST API to communicate remotely with the Activiti engine.

Modeler[edit]

web base modeling tool from Signavio. It can model all BPMN 2.0 elements, which are more than the Activiti process engine and Activiti designer can handle. Models can only used by the Designer if you use elements that are support by the Designer.

Designer[edit]

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.

Script Languages[edit]

  • Groovy (standard)

Standards[edit]

BPMN XML[edit]

API[edit]

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[edit]

createStandaloneInMemProcessEngineConfiguration()[edit]
ProcessEngine processEngine = ProcessEngineConfiguration.
                              createStandaloneInMemProcessEngineConfiguration().
                              buildProcessEngine();

start a H2 in memory database.

createStandaloneProcessEngineConfiguration()[edit]
ProcessEngine processEngine = ProcessEngineConfiguration.
                              createStandaloneProcessEngineConfiguration().
                              buildProcessEngine();

uses a connection to a running H2 database.

Using Activiti[edit]

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[edit]

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


Designer[edit]

Activities[edit]

Script Tasks[edit]

All process variables are accessible by name in the script.

Service Tasks[edit]
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[edit]

  • 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[edit]

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[edit]

Eclipse based Tutorial[edit]

Pizza Tutorial[edit]

Blog[edit]

Didn't work because of missing class.

Eclipse Project 'ActivitiTest1'[edit]

  • 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[edit]

Resources[edit]

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