about this book

Activiti is an open source Business Processing Model and Notation (BPMN) 2.0 process engine framework that provides an environment for running your business and technical processes. It’s a project funded by Alfresco and established by jBPM founder Tom Baeyens. Activiti provides much more functionality than simply running BPMN 2.0 processes in a rock-solid way. It provides a web-based modeling tool for business analysts, an Eclipse plug-in for developers, and a web application to work with and manage the processes. In addition, Activiti community members, including SpringSource, FuseSource, MuleSoft, and camunda, have implemented further functionality like full Spring integration, an OSGi bundle, Mule and Camel integration, and a CDI module.

This book is written by one of the Activiti core developers and the lead developer of the Activiti Designer component. It contains loads of examples to help you understand the BPMN 2.0 language and how to work with all the extensions Activiti provides. In the final chapters, the book goes beyond Activiti’s core functionality and shows how to do CMIS communication from a process definition and how to implement a business activity monitoring environment using the open source Esper framework.

You should not expect to find examples of all the nitty-gritty details of the BPMN 2.0 specification. Instead, the focus is on Activiti-supported elements and the most common use cases for developing process definitions.

You also won’t find in-depth discussions of the business side of BPM. Many other books focus on the business perspectives of BPM; this book focuses on the technical aspects of BPM, mostly on BPMN 2.0 and Activiti.

Who should read this book?

This book is written for everyone who’s interested in learning about Activiti. In addition, it’s a great way to learn about BPMN 2.0 from a practical perspective. Every developer, process designer and analyst, or architect will benefit from the information and examples provided to learn about the basics and details of the Activiti framework. With the technical perspective offered in this book, you shouldn’t be afraid of the Java and XML code listings.

Roadmap

The book has 14 chapters divided into 4 parts:

There are also two appendixes. Appendix A explains how to work with the source code examples, and appendix B covers elements supported by Activiti BPMN 2.0.

Part 1 shows you how to get started with the Activiti framework and explains the background of the BPMN 2.0 standard. You are introduced to the different components of the Activiti framework and developing with the Activiti API.

Chapter 1 introduces the Activiti framework and shows you how to set up the Activiti default environment. At the end of the chapter, you implement your first simple BPMN 2.0 process definition and test it with a simple JUnit test.

Chapter 2 provides a short introduction to Business Process Management. Here, you’ll learn about the background of the BPMN 2.0 standard, compared with other standards like WS-BPEL. Finally, you are introduced to core BPMN 2.0 elements.

Chapter 3 provides an overview of all the components of the Activiti framework, including the Activiti Modeler, Activiti Designer, Activiti Explorer, and the camunda fox cycle. Using a simple process example, we walk through the components and you’ll learn how to model, design, and deploy a BPMN 2.0 process definition.

Chapter 4 gives an overview of the Activiti API, starting with short code examples illustrating the main Activiti interfaces. Then, you’ll learn how to implement Java logic in a BPMN 2.0 process definition and how to work with Spring beans.

In part 2, we shift the focus from understanding the Activiti framework and BPMN 2.0 to using them to develop process definitions. We discuss and use most of the supported BPMN 2.0 elements and talk about important topics like error handling and deploying process definitions to an Activiti Engine. In the final chapter, we explore additional modules provided by the Activiti framework, such as CDI and OSGi.

Chapter 5 shows how to implement a full-blown process definition using Activiti. We explore the workflow and form capabilities of the Activiti Engine and you’ll learn how to use an email task to send emails during process execution.

Chapter 6 introduces a number of advanced BPMN 2.0 constructs and Activiti extensions. You’ll learn about multiple execution paths using the parallel gateway and how to structure larger process definitions using standalone or embedded subprocesses. You also are introduced to the JPA and listener Activiti extensions.

Chapter 7 describes ways to deal with error handling in BPMN 2.0 processes. You can use the standard error end event and boundary error event or implement an approach using Java exceptions and multiple outgoing sequence flows.

Chapter 8 talks about ways to deploy the Activiti Engine in your environment. You can choose an embedded approach, using only Activiti JARs, or go for a standalone approach using the Activiti REST API. At the end of chapter, you’ll also learn how to implement an additional REST service when necessary.

Chapter 9 shows how to make use of the Activiti OSGi bundle and the CDI module. With the OSGi bundle, you can deploy Activiti on an OSGi container like Apache Karaf and take advantage of the flexibility offered by that platform. The Activiti CDI module provides integration with the Contexts and Dependency Injection JEE framework. You can use handy annotations to quickly build a JSF process and workflow application.

In part 3, we focus on more advanced features and extensions to the Activiti framework. In the previous two parts, we looked at the basic functionality of Activiti and BPMN 2.0, so now it’s time to step up and talk about advanced ways of using Activiti. We integrate Activiti with the Drools rule engine, the Alfresco document management system, Mule and Camel for external communication, and Esper for business activity monitoring.

Chapter 10 discusses advanced workflow features with subtasks, task delegation, and the four-eye principle workflow pattern. We also show how to use an LDAP server for identity management and how to use the BPMN 2.0 multi-instance construct. And, finally, we look at how to implement additional form types and go for an external form-rendering approach.

Chapter 11 shows how you can communicate with external services and applications to execute business logic that is necessary during process execution. With the Activiti Mule and Camel modules, it’s simple to use the powerful features these frameworks provide to implement all kinds of communication logic.

Chapter 12 provides a detailed overview of how to use the Drools rule engine with Activiti business rule tasks. We start with an introduction to the Drools framework and implement a couple of rule examples. After you implement a process definition containing two business rule tasks, you’ll learn how to implement a Vaadin web application where you can change deployed rules in real time.

Chapter 13 shows how Activiti is used in the open source Alfresco product and how you can use the CMIS standard (with Apache Chemistry) to communicate with Alfresco from a process definition.

Chapter 14 introduces business activity monitoring with Activiti using the open source Esper framework. You’ll learn how to fire events to Esper using Activiti listeners and how to implement eventing logic in Esper to combine events into useful management information. Finally, you’ll see how you can implement a simple Vaadin dashboard to monitor business processes running on the Activiti Engine.

In part 4, we leave behind the development of process definitions and focus on running process definitions on the Activiti Engine in a production environment. This part consists of one chapter.

Chapter 15 discusses important topics that are needed to run processes on the Activiti Engine successfully. First, we look at the database model of the Activiti Engine in detail, and then we move on to dealing with process versioning. Then, you’ll see how jobs are handled in the Activiti Engine using the asynchronous job executor implementation. And, finally, you’ll learn how you can extend the Activiti Explorer with additional management functionality, like a report of all running and completed process instances.

Appendix A provides an overview of all the projects you’ll find in the book’s source code. Pointers are given on where each project is used in which chapter of the book. Appendix B provides a detailed overview of the BPMN 2.0 elements supported by the Activiti Engine.

Code conventions and downloads

Source code in listings or in text appears in a fixed-width font like this to separate it from ordinary text. Code annotations accompany many of the listings, highlighting important concepts. In some cases, numbered cueballs link to additional explanations that follow the listing.

There are many code examples in this book. The process definitions are described using XML code that shows the BPMN 2.0 XML elements. The process logic, like Java service tasks and listeners, is implemented in Java.

The source code for the book is divided into a number of projects. The bpmn-examples project contains the most example code and the other projects are used to implement special artifacts like web applications. For a full description of the source code projects, please refer to appendix A.

Source code for the examples in this book can be downloaded from the publisher’s website at www.manning.com/ActivitiinAction. There’s also a special website devoted to this book at www.bpmnwithactiviti.org.

Author Online

Purchase of Activiti in Action includes free access to a private web forum run by Manning Publications where you can make comments about the book, ask technical questions, and receive help from the author and from other users. To access the forum and subscribe to it, point your web browser to www.manning.com/ActivitiinAction. This page provides information on how to get on the forum once you’re registered, what kind of help is available, and the rules of conduct on the forum.

Manning’s commitment to our readers is to provide a venue where a meaningful dialog between individual readers and between readers and the author can take place. It’s not a commitment to any specific amount of participation on the part of the author, whose contribution to the forum remains voluntary (and unpaid). We suggest you try asking the author some challenging questions lest his interest stray!

The Author Online forum and the archives of previous discussions will be accessible from the publisher’s website as long as the book is in print.

About the author

Tijs Rademakers is a senior software engineer at Alfresco, where he is a member of the Activiti core development team. He is an Activiti committer to the Activiti Engine and lead developer for the Activiti Eclipse Designer. Tijs is coauthor of Open Source ESBs in Action (Manning, 2008) and has over 10 years of software engineering experience, with a focus on open source BPM and enterprise integration frameworks. He lives in Valkenswaard in the Netherlands with his girlfriend and two children.