简体   繁体   中英

Inserting a list as fact in statelessKieSession in drools

I am trying to insert a list as a fact in kieSession.what is the difference between the below two methods?.

Method1:

StatelessKieSession kieSession1 = kieBase.newStatelessKieSession();
            kieSession1.execute(List);

Method2:

StatefulKnowledgeSession kieSession = (StatefulKnowledgeSession) kieBase.newKieSession();
kieSession.insert(List);
            kieSession.fireAllRules();

I am able to iterate the list that is sent as parameter inside the drl in the stateful session, But i am not able to do that in stateless session. Can anyone tell how both sessions process the list passed as a fact?

StatelessKieSession kieSession1 = kieBase.newStatelessKieSession();
kieSession1.execute( (Object)aList );

Drools API Javadoc documents both overloaded forms of execute and explains what happens with either form.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM