Tough question to answer.  Much depends on the ROLLBACK scope that you
require.  

In otherwords you cannot answer this question without knowing more about
the problems space.  

In general, I would say that the rules should be agnostic to JTA
transactions.  This does not mean that they don't exist, only that the
rules engine is not directly concerned with them.  

One scenario that I would rule out implicitly is having one rule start
the transaction and another ending it... THIS IS BAD MOJO!

Ideally, once you have created a fact to persist in the database, you
should open a connection, write the fact and commit the data to the
database.

If your transaction must span several database operations, you should
collect all of the operations to be committed and then open the
connection write and commit (granted, this could prove difficult in
practice).

Finally, if your rule execution has a lifecycle such as a batch process
whereby the rules engine awakens to do some work completes the work and
then stops executing, I would suggest that you start the transaction
before the engine is invoked, run the engine to completion, check a
status and then end the transaction accordingly.

Bottom line:  DECISIONS, DECISIONS, DECISIONS.

- Dave


-----Original Message-----
From: Chalakanth Reddy [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 09, 2005 11:51 AM
To: [email protected]
Subject: [drools-user] Mixing JTA transactions and Drools rules


Hi,

My company is looking into converting some of our systems to a rule
based implementation.  We are currently experimenting with Drools 2.1.

I don't have much experience with the theory of business rules, or with
implementing large systems with Java based rules.  So this is a newbie
question.

Where would you recommend we place JTA transaction boundaries?
   At the client that is launching a rule set?   Start transaction; let
the
   rules run; end transaction.  The rule set is totally unaware of JTA
   transactions.

   In the backend.  Some layer of procedural Java that the Domain
Specific
   Language translates to.  Again the rule set itself is unaware of JTA
   transactions.

   Within a single rule consequence - the transaction must begin and end
   within the same consequence.

   Start transaction in one rule's consequence and end it in another
rule's
   consequence.


Any help is greatly appreciated.

thanks,

Chalakanth Reddy


This communication, including any attachments, may contain privileged or
confidential information.  It is intended for a specific individual and
purpose and is protected by law.  If you have received this
communication in error, please immediately notify me and destroy the
communication.  Any wrongful interception, disclosure, copying or
distribution of this communication, or the taking of any action based on
this communication by anyone other than the intended recipient is
strictly prohibited and punishable under federal law.

Reply via email to