I've inherited a rule engine implementation based on Drools 4.0.7 in
which we're seeingĀ a portion of rules failing to fire after we
serialize then deserialize rules and facts across the restart of our
application server.
Here is our current implementation:
serialization
===========
1. All facts are persisted to database tables from Events received via
an implementation of WorkingMemoryEventListener
2. All Rules are persisted to database tables as a collection of rule
"arguments"
deserialization
============
after an app server restart, a new RuleBase is created, and
RuleBase.newStatefulSession() is called
1. Rule "arguments" from db table are passed to an in-memory process
that writes a plain text DRL file
2. DRL string is built to a Package, then installed as a new rule
within the RuleBase
3. each individual fact is loaded from db table and inserted into the
newly created working memory (StatefulSession)
I do not believe this is a valid way of de/serialization. Reading the
tests that ship with Drools 4.0.7, as well as the documentation, it
seems the proper way is to use Java object serialization with both the
RuleBase and WorkingMemory - is that correct?
Assuming that my current serialization is incorrect, I'm investigating
how best to repopulate the newly created RuleBase and working memory
so that rules reliably fire. What I am seeing is that rules do not
fire in a non-deterministic fashion after repopulating the new working
memory as described above. Are there any suggestions for other paths
to attempt?
Thanks in advance for any help,
Ryan