[rules-users] Activation doubt
Makewise - Vitor Rui Mendonça
Vitor.Mendonca at brisa.pt
Thu May 13 05:23:48 EDT 2010
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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100513/c3ee2577/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 635 bytes
Desc: image001.jpg
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20100513/c3ee2577/attachment.jpe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 2725 bytes
Desc: image002.jpg
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20100513/c3ee2577/attachment-0001.jpe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: event.log
Type: application/octet-stream
Size: 2991 bytes
Desc: event.log
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20100513/c3ee2577/attachment.obj
More information about the rules-users
mailing list