There's no reason why two events shouldn't have identical timestamps.
Having to preserve order in the absence of any other distinction can't be
necessary? Can't you use any other attribute to derive the order?
If you think that you must have different timestamps: why don't you
apply the timestamp yourself and add a tick when the current insert
(of a stream) is still within the same ms.
BTW: You overuse salience. Add logic to get things done at the proper
time, i.e., according to the proper situation.
-W
On 24/09/2013, dunnlow <dunnlow(a)yahoo.com> wrote:
I am testing with fusion (5.5) and running into an /intermittent
/issue. I
am trying to track transitions between two big events (BEvent) using a
smaller event (SEvents) with the properties I care about. The idea is that
I will maintain many SEvents in memory for the different kinds of BEvents.
My basic steps (partly driven by salience) are:
1) rule a: (salience=100): when a new BEvent is inserted, insert a new
related SEvent
2) rule b: (salience=50): If there are two SEvents for this type of BEvent,
compare them (old vs new) and act accordingly
3) rule c: (salience=0) remove the *old* SEvent (keeping the latest one)
4) rule d: (salience=-50) retract the BEvent
My rule c (above) is:
when $se1 : SEvent(name matches "auto")
$se2 : SEvent(this after $se1, style matches ($se1.style))
then
retract($se1);
end;
I am of course running in stream mode and this USUALLY works, but sometimes
rule c does not get activated - based on the audit log. Also, I have a
DebugWorkingMemoryEventListener configured and I can see that two SEvents
DO
exist in working memory which should activate it.
In my test, I have a loop in which I am inserting events. When I add a
brief delay, I have not seen a failure. My guess is that the timestamps on
the two events are the same, thus the "after" is causing the issue.
However, I am unable to test this as the timestamp on the event is not
accessible (from what I have found on this forum).
I saw a suggestion here about using a variable on my SEvent to tell the
difference between a new and old version. I also considered using some
sort
of counter bean to order the SEvents (although I believe it would need to
be
serialized).
My questions:
1) Do you agree with my assessment? Is it possible in stream mode to have
two events with the same timestamp?
2) what is the BEST way to identify which event was inserted first?
Thanks for any insight!
-J
--
View this message in context:
http://drools.46999.n3.nabble.com/Fusion-5-5-Deterministically-identifyin...
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