Re: [rules-users] Event and Facts Problem
Thank you! That is right... It was my fault by posting the wrong code of mine. I used to modify the event itself, which isn't the right way since they are immuteable, and getting the same error. But with retract($request) it is working properly ;) -- View this message in context: http://drools.46999.n3.nabble.com/Event-and-Facts-Problem-tp4024622p4024698.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Event and Facts Problem
Well, the rule says: "With a Resource in state 0 and a Reservation request, do...". It's like two cars parking along the double yellow line (without a ticket yet) and a traffic warden arriving at the scene: it'll be a ticket for each car... -W On 28/06/2013, Andynator wrote: > hey, > I have a problem with events and facts: when i have two existing facts > (resources) und i am inserting an event (request), then following rule is > fired twice (for each resource) > > /declare ReservationRequest > @role ( event ) > @timestamp ( timestamp ) > @expires(0s) > end > > rule "Allocate" > no-loop true > when > $resource : Resource(state == 0) > $request : ReservationRequest() from entry-point "EventStream" > then > modify($resource) { setState(1) }; > insert(new Allocation($resource, $request.getDuration())); > > log.warn("Rule 'Allocate' fired: '" + $resource.getName() + "' on > Request '" + $request.getName()); > end/ > > Any ideas why? > > > > -- > View this message in context: > http://drools.46999.n3.nabble.com/Event-and-Facts-Problem-tp4024622.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Event and Facts Problem
hey, I have a problem with events and facts: when i have two existing facts (resources) und i am inserting an event (request), then following rule is fired twice (for each resource) /declare ReservationRequest @role ( event ) @timestamp ( timestamp ) @expires(0s) end rule "Allocate" no-loop true when $resource : Resource(state == 0) $request : ReservationRequest() from entry-point "EventStream" then modify($resource) { setState(1) }; insert(new Allocation($resource, $request.getDuration())); log.warn("Rule 'Allocate' fired: '" + $resource.getName() + "' on Request '" + $request.getName()); end/ Any ideas why? -- View this message in context: http://drools.46999.n3.nabble.com/Event-and-Facts-Problem-tp4024622.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users