[rules-users] Basic doubt regarding Drools Fusion - @expires

Edson Tirelli ed.tirelli at gmail.com
Thu Mar 17 12:59:23 EDT 2011


   Yes, please. Thank you,

   Edson

2011/3/17 Makewise - Vitor Rui Mendonça <Vitor.Mendonca at brisa.pt>

>   I forgot to mention that I’m running in stream mode, yes J
>
>
>
> I’m having problems regarding event expiration: I define events with
> @expires(1h) but they won’t disappear, I had to write some rules to force
> the expiration.
>
>
>
> To keep short a long history… J
>
> ·         I put transactions into entry-point “incoming”
>
> ·         I’ve got rules that create a new event (defined in .drl file)
> when a transaction is inserted in the working memory. That event has an
> expire time (1h)
>
> ·         But I’ve notice that the created event will never go away
>
>
>
> *// transaction inserted into working memory through insertFact()*
>
> *declare* Transaction
>
>       @role( event )
>
>       @expires( 1h )
>
> *end*
>
> * *
>
> *// event created when working memory receives transaction*
>
> *declare* ExampleTransaction
>
>       @role( event )
>
>       @expires( 1h )
>
>       value: *int*
>
>       transaction: Transaction
>
> *end*
>
> * *
>
> *// rule to create event *
>
> *rule* "new example transaction"
>
> *when*
>
>       $transaction : Transaction() over window:time(1h) *from* entry-point
> "incoming"
>
> *then*
>
>     ExampleTransaction exampleTransaction = *new* ExampleTransaction();
>
>     exampleTransaction.setValue(0);
>
>     exampleTransaction.setTransaction($transaction);
>
>     *insert*( exampleTransaction );
>
> *end*
>
>
>
>
>
> Maybe submitting a new issue with a JUnit test would be nice, right? 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>
>
>
>
>
>
>  ------------------------------
>
> Declaração:
> A informação contida nesta mensagem, e os ficheiros anexos, é privilegiada
> e confidencial, destinando-se exclusivamente ao(s) destinatário(s).Se não é
> o destinatário (ou o responsável pela sua entrega ao destinatário) e recebeu
> a mesma por engano, fica notificado que é estritamente proibido reproduzir,
> guardar ou distribuir toda ou qualquer parte desta mensagem e ficheiros
> anexos.Por favor reencaminhe a mensagem para o responsável pelo seu envio ou
> contacte-nos por telefone e elimine a mensagem e ficheiros anexos do seu
> computador,sem os reproduzir.
>
> Disclaimer:
> The information contained in this message, and any files attached, is
> privileged and confidential, and intended exclusively for the included
> addresses.If you are not the intended recipient (or the person responsible
> for delivering to the intended recipient) and received this message by
> mistake, be aware that copy, storage, distribution or any other use of all
> or part of this message and the files attached is strictly prohibited.
> Please notify the sender by reply e-mail or contact us by telephone and
> delete this message and the files attached, without retaining a copy.
>  ------------------------------
>
>  *From:* rules-users-bounces at lists.jboss.org [mailto:
> rules-users-bounces at lists.jboss.org] *On Behalf Of *Edson Tirelli
> *Sent:* quinta-feira, 17 de Março de 2011 13:41
>
> *To:* Rules Users List
> *Subject:* Re: [rules-users] Basic doubt regarding Drools Fusion -
> @expires
>
>
>
>
>
>    You lost me. Why are you defining a rule to retract your event? If you
> are running in STREAM mode, @expires will take care of the retraction for
> you automatically...
>
>
>
>    Regarding threads, I said by default because there is an experimental
> feature that makes drools start internal threads, but that is not production
> ready yet.
>
>
>
>    Edson
>
>
>
> 2011/3/17 Makewise - Vitor Rui Mendonça <Vitor.Mendonca at brisa.pt>
>
> Edison, first of all, thanks for your quick reply!
>
>
>
> Those initial words caught my attention, although: “By default, Drools
> does not start any internal thread”…
>
>
>
> What do you mean “by default”?
>
> I know there are ways to force the event to be expired but I’m looking for
> a solution that doesn’t involve to write new rules.
>
>
>
> For example, I’m using this kind of solution:
>
> *declare* A
>
>       @role( event )
>
>       @expires( 1h )
>
> *end*
>
> *rule* "internal - expiring A"
>
>       timer(*int*:1h)
>
> *when*
>
>       $a : A() *from* entry-point "incoming"
>
> *then*
>
>       *retract*($a);
>
> *end*
>
>
>
> Although this solution works (from Drools 5.1), I’m forced to write a rule
> to expire an event that’s supposed to be expired initially.
>
> There’s a simpler way to do this? I’m thinking correctly?
>
>
>
> Once again, thanks!
>
>
>
>   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>
>
>
>
>
>    ------------------------------
>
>
>
> Declaração:
> A informação contida nesta mensagem, e os ficheiros anexos, é privilegiada
> e confidencial, destinando-se exclusivamente ao(s) destinatário(s).Se não é
> o destinatário (ou o responsável pela sua entrega ao destinatário) e recebeu
> a mesma por engano, fica notificado que é estritamente proibido reproduzir,
> guardar ou distribuir toda ou qualquer parte desta mensagem e ficheiros
> anexos.Por favor reencaminhe a mensagem para o responsável pelo seu envio ou
> contacte-nos por telefone e elimine a mensagem e ficheiros anexos do seu
> computador,sem os reproduzir.
>
>
>
> Disclaimer:
> The information contained in this message, and any files attached, is
> privileged and confidential, and intended exclusively for the included
> addresses.If you are not the intended recipient (or the person responsible
> for delivering to the intended recipient) and received this message by
> mistake, be aware that copy, storage, distribution or any other use of all
> or part of this message and the files attached is strictly prohibited.
> Please notify the sender by reply e-mail or contact us by telephone and
> delete this message and the files attached, without retaining a copy.
>   ------------------------------
>
> *From:* rules-users-bounces at lists.jboss.org [mailto:
> rules-users-bounces at lists.jboss.org] *On Behalf Of *Edson Tirelli
> *Sent:* quarta-feira, 16 de Março de 2011 18:38
> *To:* Rules Users List
> *Subject:* Re: [rules-users] Basic doubt regarding Drools Fusion -
> @expires
>
>
>
>
>
>    By default, Drools does not start any internal thread, so that you can
> embed it in non-multithread applications or in JEE containers. That means
> that the actual release of events in such cases depends on triggers. In your
> example, after 1h has passed, whenever something happens to the session (a
> new rule is fired, a new event is inserted, the session clock is advanced,
> etc), the event will be expired as part of the action. Remember though that
> it only happens when running in STREAM mode. In CLOUD mode, event garbage
> collection does not make sense and will not happen.
>
>
>
>   Edson
>
> 2011/3/16 Makewise - Vitor Rui Mendonça <Vitor.Mendonca at brisa.pt>
>
> Hi all!
>
>
>
> I’ve got a really basic doubt… I’ve read several documentation regarding it
> but I think I need some advice here…
>
>
>
> Imagine that I have an event:
>
> *declare* A
>
>       @role( event )
>
>       @expires( 1h )
>
> *end*
>
>
>
> On my Java code, I call “fireAllRules()” method every time that I put an
> event into the working memory.
>
>
>
> My doubt: When does event A expires?
>
> a)      One hour after it was inserted (time-based and without the
> “fireAllRules()” method call) or
>
> b)      by calling “fireAllRules()” method (event-based)
>
>
>
> T.I.A.
>
>
>
>   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>
>
>
>
>
>   ------------------------------
>
>
>
> Declaração:
> A informação contida nesta mensagem, e os ficheiros anexos, é privilegiada
> e confidencial, destinando-se exclusivamente ao(s) destinatário(s).Se não é
> o destinatário (ou o responsável pela sua entrega ao destinatário) e recebeu
> a mesma por engano, fica notificado que é estritamente proibido reproduzir,
> guardar ou distribuir toda ou qualquer parte desta mensagem e ficheiros
> anexos.Por favor reencaminhe a mensagem para o responsável pelo seu envio ou
> contacte-nos por telefone e elimine a mensagem e ficheiros anexos do seu
> computador,sem os reproduzir.
>
>
>
> Disclaimer:
> The information contained in this message, and any files attached, is
> privileged and confidential, and intended exclusively for the included
> addresses.If you are not the intended recipient (or the person responsible
> for delivering to the intended recipient) and received this message by
> mistake, be aware that copy, storage, distribution or any other use of all
> or part of this message and the files attached is strictly prohibited.
> Please notify the sender by reply e-mail or contact us by telephone and
> delete this message and the files attached, without retaining a copy.
>   ------------------------------
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> --
>   Edson Tirelli
>   JBoss Drools Core Development
>   JBoss by Red Hat @ www.jboss.com
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> --
>   Edson Tirelli
>   JBoss Drools Core Development
>   JBoss by Red Hat @ www.jboss.com
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110317/c0047bc5/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 635 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20110317/c0047bc5/attachment.jpe 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 2725 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20110317/c0047bc5/attachment-0001.jpe 


More information about the rules-users mailing list