Hello,

there are several approaches, and I'll discuss some of them.

(1) Save all facts at the time of the crash. You'll have to assume that the
Rete object is still useable and hasn't been corrupted. (I'm not implying
that Jess code is buggy, but certain abuses via the API might do the trick.)

(1a) Call Rete.bsave(). This will not work if your facts contain references
to POJOs or even other facts. But if your facts can be bsave'd properly,
then it might be a simple solution, as the java.io.OutputStream could be any
of the possible implementations of this abstract class.
(1b) Iterate over the facts and serialize. If you have shadow facts, then
the Object backing the fact might implement java.io.Serializable, either the
default way or using your own writeObject/readObject methods. This should
also cope with POJO references, but you'll have to be careful with fact
references. Also, XML is an option, e.g., by defining your Objects in a
Schema and generating the code for the backing objects from there. Notice
that XML is capable of representing references, but marshalling assumes an
object tree, which would produce duplications of referenced elements.

(2) Log all WM updates. You could add this even now, by adding a
JessListener. This means more work as you have to register the operations
along with the data, but it provides additional possibilities. Also, there's
nothing to do at the time of the crash, and you don't have to rely on Rete
(or other objects) still being OK. Object serialization is still an issue -
cf. (1) - and heavy use of POJO references from facts might make this
approach difficult or even impossible.

Regards
Wolfgang

On Fri, Apr 3, 2009 at 5:21 AM, Angus Wong <[email protected]> wrote:

>
> Hi,
>
> I'm now integrating the Jess rule engine into my application and I would
> like to seek some advice in terms of recovery in case of crashing.
>
> 1) What would be the suggested method to "save" the Rete state (i.e. facts
> in working memory)? There is a bsave() method in Rete, but it might
> potentially introduce a large amount of I/O, because the working memory
> might be flushed to the disk for any changes in the working memory, which
> might not be a decent solution.
>
> 2) A step further, is there a way to externalize the working memory? So
> that
> the working memory could be stored in persistence memory cache by somehow
>
> 3) Would it be possible to migrate part of the facts from a crashing Rete
> instance to some "healthy" instances? For examples, the facts in a crashing
> instance is partitioned into 3 and each portion of the facts would be added
> to other 3 healthy running instances.
>
> Greatly appreciate for any comments/inputs
>
> Many Thanks,
> Angus
> --
> View this message in context:
> http://www.nabble.com/Seeking-Advice-on-Rete-Recovery-tp22861283p22861283.html
> Sent from the Jess mailing list archive at Nabble.com.
>
>
>
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [email protected]'
> in the BODY of a message to [email protected], NOT to the list
> (use your own address!) List problems? Notify [email protected].
> --------------------------------------------------------------------
>
>

Reply via email to