How to get logically inserted fact or insrt fact in code in Drools guvnor

StackOverflow https://stackoverflow.com/questions/16211467

  •  11-04-2022
  •  | 
  •  

سؤال

My guvnor rule is like :

Rule "aa" 
 dialect "mvel" 
  when 
    Fund( amount> 10000 ) 

then 
 Alert fact0 = new Alert(); 
 fact0.setSummary( "hi" ); 
 insert( fact0 ); 
end 

and using stateless knowledge session. Now I want to get that fact0 in code. How to do that?
Please help me.

هل كانت مفيدة؟

المحلول

The most drools-friendly way to do it is by using queries. Another option is to use ksession.getObjects(). You can take a look to this answer: Retrieving facts of a specific type from working memory

Hope it helps,

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top