Hi Rainer! I'm really glad to talk to someone else doing EJB and JESS. I
don't promise to be doing it the right way, but:
We created an ExpertSystemAdapter class, which is a normal class that
contains the RulesEngine and is responsible for its basic care and feeding.
We did that to encapsulate the basic code, because we use the rules engine
in different circumstances. Usually the adapter is part of a Session Bean.
All user and other bean calls are through the owning Session Bean, which
more or less automatically handles the security context, access across
multiple VM's, etc. We chose to copy attributes of the system into Jess as
Jess Fact objects, because it reduced the amount of Java and system
knowledge required to maintain the rules. We experimented with binding
Entity and Session Beans directly to variables in the JESS engine. I was
apprehensive particularly because of passivation issues and partly because
of not knowing how JESS would react to the range of Weblogic/EJB exceptions
that can be thrown. I think it is a credit to Ernest Friedman-Hill, if he is
listening, that there were no problems whatsoever.
Because we use the fact objects, actual changes to the state of a bean and
any subsequent transaction roll-back are handled by the owning Session bean,
rather than the engine. As a general comment, may I say that I spent several
frustrating days unconciously trying to write "object oriented" rules, if
you know what I mean. It took somewhat of a brain re-adjustment, but I
found I could create much simpler, clearer rules if I didn't try to make
things process oriented, which meant I had to leave transactional stuff in
the adapter. I suspect, maybe Ernest will answer, that JESS will provide
much better performance the less you force it to do function calls, even
JESS function calls, to evaluate the state of a LHS.
>From a logical perspective we have one Session bean/adapter/Rete per user,
although obviously what really happens depends on the EJB server, system
load, etc.
What are you thinking?
Rainer Schmitz wrote:
> I'm going to try integrating jess in an Enterprise JavaBeans
> environment.
>
> Has anyone experience with or information about this?
> Issues of interest include:
> - How to integrate jess rule evaluation in the EJB container environment
> (keeping transaction and security context etc.).
> - Accessing the same rule enginge instance from different Enterprise
> JavaBeans.
> - Accessing a rule engine from an EJB in a different VM.
> - Scope of a rule engine (e.g. one rule engine per EJB-Server, per VM,
> per user session...?).
>
> Those are only some points coming to my mind immediately. I'm sure there
> is a lot more to think about and every hint would be appreciated.
>
> Thanks
> Rainer
---------------------------------------------------------------------
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]
---------------------------------------------------------------------