understanding agenda-group in drools

后端 未结 2 452
后悔当初
后悔当初 2021-02-02 15:01

I tried a sample example to see how agenda-group works. Initially I set the focus of ksession to agenda-group \"ag1\" and fired the rules.

package com.sample

im         


        
2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-02 15:41

    Since you changed facts in the session (your Message object is in your facts i guess) during the computation of a rule, other rules are computed again, not depending on the agenda-group they belong to, in order to update the Drools knowledge base.

    You could add no-loop true to prevent this on the line after rule definition

    I'm not quiet sure, but it's the behavior i noticed on my app and should so resolve your infinite loop. By the way, it seems logical to compute again rules when facts change.

提交回复
热议问题