Re: [rules-users] rule does not fire at first event

2011-11-09 Thread ukriegel
After insertion of the event, fireAllRules() is called.

In fact, there is in addition a default rule

rule "default"

dialect "java"
when Command() from entry-point "XXX"
then
System.out.println("No reaction on Command "+new Date());
end

which fires with the same timestamp as the rule which creates the fact
ActivityState

--
View this message in context: 
http://drools.46999.n3.nabble.com/rule-does-not-fire-at-first-event-tp3494056p3495981.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] rule does not fire at first event

2011-11-09 Thread Mauricio Salatino
Are you calling the fireAllRules() method after inserting the events? or
using fireUntilHalt()?
You can activate the log to see what is happening with:
KnowledgeRuntimeLoggerFactory.newConsoleLogger(session);

Cheers

On Wed, Nov 9, 2011 at 1:37 PM, ukriegel
wrote:

> Hi there,
> we use drools fusion 5.3. Final.
> In a drl-file, a fact and an event and the following rules are declared
>
> package ... etc
>
> declare ActivityState
>@role(fact)
>state : StateType
> end
>
>
> rule "set initial state"
>dialect "java"
>salience 100
>when not (exists KFActivityState())
>then
>ActivityState $actState = new ActivityState();
>$actState.setState(StateType.STANDBY);
>insert($actState);
>System.out.println("ActivityState inserted "+ new Date());
> end
>
>
>
>
> declare Command
>@role (event)
> end
>
>
> rule "request information"
>dialect "java"
>when Command(commandType == CommandType.REQUEST_INFORMATION) from
> entry-point "XXX"
> $s: ActivityState(state ==
> ComponentStateType.ACTIVE||state ==
> ComponentStateType.PASSIVE||state == ComponentStateType.STANDBY)
>then
> System.out.println("Send Report");
> end
>
>
> The rule request information doesn't fire with the first command event, but
> from the second one it fires always.
>
> What's wrong with my code?
>
> Thanks in advance
>
> Ulrich
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/rule-does-not-fire-at-first-event-tp3494056p3494056.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
>



-- 
 - CTO @ http://www.plugtree.com
 - MyJourney @ http://salaboy.wordpress.com
 - Co-Founder @ http://www.jugargentina.org
 - Co-Founder @ http://www.jbug.com.ar

 - Salatino "Salaboy" Mauricio -
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] rule does not fire at first event

2011-11-09 Thread ukriegel
Hi there,
we use drools fusion 5.3. Final.
In a drl-file, a fact and an event and the following rules are declared

package ... etc

declare ActivityState
@role(fact)
state : StateType
end


rule "set initial state"
dialect "java"
salience 100
when not (exists KFActivityState())
then
ActivityState $actState = new ActivityState();
$actState.setState(StateType.STANDBY);
insert($actState);  
System.out.println("ActivityState inserted "+ new Date());
end




declare Command
@role (event)
end


rule "request information"
dialect "java"
when Command(commandType == CommandType.REQUEST_INFORMATION) from
entry-point "XXX"
 $s: ActivityState(state == ComponentStateType.ACTIVE||state ==
ComponentStateType.PASSIVE||state == ComponentStateType.STANDBY)
then
 System.out.println("Send Report");
end


The rule request information doesn't fire with the first command event, but
from the second one it fires always.

What's wrong with my code?

Thanks in advance

Ulrich

--
View this message in context: 
http://drools.46999.n3.nabble.com/rule-does-not-fire-at-first-event-tp3494056p3494056.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