Hi folks!

 

I'm having some trouble to understand activations.

My system receives transactions and I want to detect periods of time without 
transactions. If I don't have transactions for an hour, I want to sound an 
alarm.

 

I've wrote the following rules just to see how Drools works (I've tried sliding 
windows also but without success):

declare NoTransactions

      @role( event )

      timestamp: long

end

declare EngineStart

      @role( event )

      timestamp: long

end

declare Transaction

      @role( event )

      @expires( 1h )

end

rule "***start***"

      when

            not( EngineStart() ) 

      then

            insert( new EngineStart() );

            System.out.println("engine started");

end

rule "***notrx_after_start***"

      when

            $engineStart : EngineStart()

            not( NoTransactions() )            

            not(Transaction( this after [0s, 1h] $engineStart ) )

      then

            insert ( new NoTransactions() );

            System.out.println("no transactions for an hour since engine 
started");

end

rule "***notrx_after_trx***"

      when

            EngineStart()

            not( NoTransactions() )

            $transaction : Transaction()

            not( Transaction( this != $transaction, this after [0s, 1h] 
$transaction ) )

      then

            insert( new NoTransactions() );

            System.out.println("no transactions for an hour since last 
transaction ");

End

·         First rule inserts an Event when rule engine starts

·         Second rule detects absence of transactions since engine started

·         Third rule detects absence of transactions since last transaction

 

The testcase is simple (using pseudoclock):

·         00h00m: rule engine start

·         00h30m: insert a transaction

·         01h01m: notification of absence of transactions since engine started 
(not the desired behavior)

 

I've attached the logs and I can't understand how an Activation is cancelled 
and executed afterwards (without any creation).

 

Thanks for the time spent to read this email! J 

 

 

 

Vítor Mendonça Moreira
Analista / Programador
Direcção de Investigação e Desenvolvimento

Rua Dr. Francisco Sá Carneiro, nº. 4 r/c esq.
2500 - 206 - Caldas da Rainha
Tel: (+351) 262 832 196
Fax: (+351) 262 186 455
Web: www.makewise.pt
Uma empresa: Grupo Sousa Pedro <http://www.sousapedro.com>  

 

                

 

<<image001.jpg>>

<<image002.jpg>>

Attachment: event.log
Description: event.log

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to