0

When application creates multiple state-full kie session, do they share same working memory or they have separate working memory. So if a fact is inserted in one session , will it be available in another session.

1 Answers1

1

A KieSession IS the working memory. You can create multiple, independent KieSessions from a single KieBase, but if you want to broadcast facts to multiple session you will need to implement that mechanism yourself.

Hope it helps,

Esteban Aliverti
  • 6,259
  • 2
  • 19
  • 31
  • My application creates multiple sessions in asynchronous fashion. Each session has two category of rules that get fired . In first set of rules all the required object from DB are loaded into the working memory, second set of rules uses the objects loaded in previous set of rules as condition. – Madhav kumar jha Nov 28 '18 at 09:34
  • So session 0 rule (second set of rules) makes a db call to save the object in DB. Before the object get saved in DB, session 1 rules(first set of rules) get triggered and since object is not saved in DB, it doesn't insert the fact in working memory of session 1. Hence session 1 rule(second set of rule), again saves the same set of data (which is already inserted by session 0 rule) – Madhav kumar jha Nov 28 '18 at 09:34
  • also the process of saving data in DB from rule is asynchronous. It just sends data to db service queue and doesn't wait for any response. – Madhav kumar jha Nov 28 '18 at 09:37