Activiti tutorial

bpmn-64x64Activiti is an open-source BPMN platform distributed under the Apache license. It's written in Java and thus can run in any Java application, on a server, on a cluster or in the cloud. Activiti integrates perfectly with Spring, it is extremely lightweight and based on simple concepts.  Here's a first tutorial which shows you a first taste of this very interesting workflow and Business Process Management (BPM) Platform.

 

The installation of Activiti is not particularly tricky, you are adviced to follow the excellent User guide  so we will build a simple example which runs on Tomcat and JBoss AS. In short, you should should prepare your environment (from the setup folder)

 

ant demo.start					

(This will create required tables, download tomcat and install libraries and examples)

Then download Eclipse plugin (if you plan to design your processes from Eclipse)
http://activiti.org/designer/update/

 

Create a New Web Project

Ok. Now let's create a Web application which uses Activiti Api to start process instances and generates a Task list.
Create a new Dynamic Web application from Eclipse menu: File | New | Other | Web | Dynamic Web project and choose a name for it.

Configure Activiti libraries in the project

Now add the following libraries to your project (You can find them in the files/dependancies/libs of your Activiti installation)

- stax-api-1.0-2.jar
- vaadin-6.4.8.jar
- activiti-engine-5.1.jar
- jaxb-api-2.2.1.jar
- jaxb-impl-2.2.1.jar
- mybatis-3.0.1.jar
- spring-asm-3.0.3.RELEASE.jar
- spring-beans-3.0.3.RELEASE.jar
- spring-core-3.0.3.RELEASE.jar
- activity.cfg.jar
- mail-1.4.1.jar
- activation-1.1.jar
- commons-email-1.2.jar
- commons-logging-1.1.1.jar
- livetribe-jsr223-2.0.6.jar
- activity.cfg.jar

Please note that activity.cfg.jar contains the Activity engine setup (activity.cfg.xml).

Here's an example activity.cfg.xml which I have created for Oracle:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd">

 <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
 
 <!-- Database configurations  -->
 <property name="databaseType" value="oracle" />
 <property name="jdbcUrl" value="jdbc:oracle:thin:@192.168.1.1:1521:ACTIVITI" />
 <property name="jdbcDriver" value="oracle.jdbc.driver.OracleDriver" />
 <property name="jdbcUsername" value="USER" />
 <property name="jdbcPassword" value="PASS" />
 
 </bean>

</beans>

 

Search our tutorials