When new technologies are added to a solution stack, it is usually to ease the developer’s life or add a wanted feature by the end users. In the case of the Activiti BPM engine, I would say it was for both of these reasons, and to stick as much as possible to the open source policy Alfresco tends to follow. So when BPMN 2.0 standard came out, Alfresco invested resources on implementing a new open source BPM engine to embed; this BPM engine is called Activiti.
There are plenty of blog posts and articles explaining how Activiti works, how to develop workflows, and how it differs from JBPM. This blog post is focused on one of the Activiti features that JBPM does not provide. This feature, Activiti’s History Service, can be used for auditing, reporting, and tracking all the processes a document has gone through. This service exposes information about ongoing and past process instances.
In JBPM, when a process is completed, all the data regarding that process instance is removed from the database and no trail remains in the system, unless custom code was written for the purpose of tracking. With Activiti, this data remains in specific database tables, as shown below (the ones in the orange square), and can be queried.
The History Service enables you to query those tables in a clean and easy way. This service exposes a set of methods to query all the process instances, task instances, and variables stored in the database.
The following code queries all the process instances a certain node has been involved in.
This information can be exposed to reporting systems via webscripts, or used to audit who performed which action in the workflows.