Sorry about my Socratic method of asking leading questions - I thought
it was rather evident.
A context is indeed there to save the result. First time round,
there's a set of matching facts, and the accumulate method is called
with a contribution for each of them; then we have a result.
Now there are three possibilities:
(1) there are no changes in the set of matching facts,
(2) another matching fact is detected,
(3) one of the matching facts is retracted
(2) is handled with a call to accumulate(), and (3) is handled with a
call to reverse(). After this, the context continues to hold the
result.
With some accumulations, reverse() is too difficult to implement. Take
max() or min(), for instance. That's why the accumulate function has
to indicate whether it is capable of going into reverse. If it isn't.
a retraction must be followed by recomputing from scratch. Now, if you
can't reverse what you have in a context, what's the point of keeping
the context in the first place?
So, check you "test" accumulation. Does it indicate that it can
compute reverse()?
There you are :)
-W
On 21/06/2012, ekzl(a)yahoo.com <ekzl(a)yahoo.com> wrote:
Wolfgang,
Again many thanks for you response but it's just not clear for me.
According to me if i have 1 million TestEvents and after each insert I call
fireAllRules i will end up with 1 million accumulate context of type test
in
my example.
Meaning that if the event in my case belongs to the same customer the
accumulate method will be called 1 million x 1 million.
So that seems to me not really scalable.
So i wonder as there is already a context created after the first
accumulate
and it seems to me that the engine is aware of it as for consecutive events
it also calls the accumulate method on that context it should not create a
new context. What is the purpose of a new context?
The accumulate doesn't stop when i return a null contex, is there any other
way to avoid creating that context?
Regards,
e
Thx,
e
--
View this message in context:
http://drools.46999.n3.nabble.com/Accumulator-being-executed-depending-on...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users