Thanks all for replying.

We currently already have a layer of service (DAO) to retrieve data from
the database. We were thinking along the line you suggested there, but
somehow, we have the impression that it's not quite as efficient as we
would like.

If we were to load the data from the database so that Rules can pick those
we wanted, we would have to load records in the range of hundreds of
thousands (or even more), which would kill our system there. It would be
much less expensive to do this with a single query statement.

Right now, we are thinking along the line of, say, letting the rules generate
a query statement on the fly, based on the result from firing the rules. But that's
much more complicated to achieve that just writing the SQL directly.

Now, to make things more complicated (as per the business requirements),
if we use rules, we have to run parts of the rules first, retrieve parts of the
data, then run the second part of the rules (which use the first part of data
to make decision), then retrieve next part of data, and so on. This does not
seem like an efficient way though. With SQL, we could write a more or less
complicated statement (with sub-queries and the usual suspect), and get
the final result in one shot.

The major issue we have with rules is that it assumes all data necessary for
firing the rules are in memory. This works fine for small systems (and with small
number of users). But right now, we couldn't figure out an efficient way to work
with large amount of data already in the database.

Maybe we are are not thinking in the right line of reasoning. Please help to
point out what's wrong.

If someone had experience dealing with large database system and is willing to
share the experience, that would be really appreciated.

We are currently using Rules v3.0.5. Will try the v3.1.0.

Best,

Marcus Ilgner <marcus.ilgner@gmail.com> wrote:

That's probably the best solution. Using the current version (3.1M1),
you can use the FROM keyword to reference facts from List object
returned from a method call on a service, for example.
Something like this works very good in my current testing project:

rule foobar
when
MyObject( someValue = "foobar" ) from MyObjectDAO.loadAll()
then
...
end

The DAO then uses Hibernate to load some objects and returns a
List which can be used by Drools.
As Uday already wrote, you could also write a DAO which retrieves
arbitrary objects using a given HQL statement.

Best regards
Marcus
_______________________________________________


No need to miss a message. Get email on-the-go
with Yahoo! Mail for Mobile. Get started.