There's a section in the documentation "Persistence and Transactions",
which explains how to save and reload a session. It will have to be a
StatefulKnowledgeSession, but that shouldn't matter - you just lose the
simple "one shot" execution API call, and you don't want this any more
anyway.
But have you timed the insertion of the "reference facts", after creating a
StatefulKnowledgeSession? It's conceivable that this isn't really taking
all that long, but of course it depends on the structure of the rules and
how much work needs to be done to get them into the Rete structure. Anyway,
this time is the maximum gain, but deserilaizing the inserted fact in the
(Rete) context of the saved session is going to cost a little, too.
-W
On 30 September 2012 12:10, Chris Selwyn <chris(a)selwyn-family.me.uk> wrote:
I have a need to execute a set of rules on a complicated hierarchical
data
structure where some of the rules use a bunch of reference facts.
At the moment I load the reference facts and the hierarchical structure
into the WM of a stateless session on every execution.
There are a lot of reference facts and they start off in the same state on
every execution though they can get modified as part of the rules execution.
I would really like to be able to save the WM after inserting the
reference facts so that I can start each execution with those facts
pre-loaded and thereby avoid loading them each time.
Is this an easy thing to do? Could someone give me some pointers?
Chris
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users