Information Technology Reference
In-Depth Information
History logs - extending the basic functionality
We previously mentioned that jBPM6 stores the minimal information to be able to recover
a KIE session and its process executions in another place. Most of the time in productive
environments, we want to keep information that is not directly required by the runtime, but
is instead used by KPIs. These KPIs can be used to know about which tasks took longer,
how many process instances are completed or pending, and many other inquiries.
In order to provide that information to the database and also to publish any piece of process
information to external tools, we will use a specific implementation of the Pro-
cessEventListener interface.
Process event listeners will expose all the process execution information through different
methods that expose process starts, completions, and node and variable changes. We ex-
plored them previously in Chapter 7 , Defining Your Environment with the Runtime Man-
ager . In this case, we use the interface as a connection point to expose all that information
in a different set of entities: the NodeInstanceLog , ProcessInstanceLog , and
VariableInstanceLog classes. All the information can be checked later through a
series of services. Summarizing all things needed to work with the history logs, we need
the following four components:
• The jbpm-audit dependency added to the classpath:
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-audit</artifactId>
<version>6.1.0.Beta3</version>
</dependency>
• The history log entities added to the persistence unit (the three classes enumerated
previously, ProcessInstanceLog , NodeInstanceLog , and Vari-
ableInstanceLog )
• Adding the specific ProcessEventListener implementation to our KIE ses-
sion:
ksession.addEventListener(
AuditLoggerFactory.newJPAInstance(environment));
• Instantiating and using the audit log service to query the generated history logs:
Search WWH ::




Custom Search