Information Technology Reference
In-Depth Information
Persistence in jBPM6
The persistence and transaction mechanisms in jBPM6 are not considered to be an extern-
ally consultable source of information; they provide a quick store and recovery mechanism,
mainly to have a high-performance distributed platform. This means that the simplest way
to configure the persistence in jBPM6 will have two characteristics:
• Only enough information to recreate the runtime is persisted. This means that we
will have limited information about our process instances; only currently running
processes will be stored, and only the information of the currently active nodes and
used variables will be available. The rest of the information can be persisted as
well, but through other mechanisms (see the History logs - extending the basic
functionality section further in this chapter).
• The runtime information is persisted in the fastest way possible: serialized inform-
ation in a byte array structure. This makes information for the basic persistence
mechanism hard to read from external tools.
The persistence and transaction mechanisms for jBPM6 are directly applied from the KIE
session. This means that not only the process runtime has a persistence mechanism for
jBPM6, but also the rule runtime. This is because the same mechanism that is used by
Drools to store content in a database is extended by jBPM6 to also store process instance
information.
This is the best way to guarantee that the exact same environment that started running a
process in one server or thread will be the one that will continue running it in another place.
This is especially important if you're using rules that are invoking references to different
process instances. We will see some examples of such types of rules in Chapter 9 , Integra-
tion with Other Knowledge Definitions .
The configuration needed to create and load a JPA persistent KIE session with persistent
process instances converges in code similar to the following:
KieServices ks = KieServices.Factory.get();
Environment env = ks.newEnvironment();
EntityManagerFactory emf = ...;
TransactionManager tm = ...;
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
env.set(EnvironmentName.TRANSACTION_MANAGER, tm);
KieBase kbase = ks.getKieClasspathContainer().getKieBase();
Search WWH ::




Custom Search