I'm using Drools 5.5 (and guvnor) Can anyone point me to example where a knowledge agent is used with persistence. I am trying to understand how the knowledgeagent is used with a persisted session. Fundamentally when my app starts, I am trying to do one of two things:
If a persisted session does not exist, start a new one and update it whenever my knowledgebase (in guvnor) changes ELSE If a persisted session already exists (i.e. at a system restart), load the existing session and continue to monitor it for changes. I have the persistence working and the monitoring of changes (with a knowledgeagent) working independently, but not together. My code: Environment env = KnowledgeBaseFactory.newEnvironment(); env.set(EnvironmentName.ENTITY_MANAGER_FACTORY,myEMF); env.set(EnvironmentName.TRANSACTION_MANAGER, myTxManager); To create/retrieve my ksession I have tried both: ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kAgent.getKnowledgeBase(),null,env) This creates a persisted session, but it is never updated with changes I also tried: ksession = kAgent.getKnowledgeBase().newStatefulKnowledgeSession(null,env); This updates the ksession with changes, but never persists the session I figure I can add a KnowledgeAgentEventListener to the agent and then recreate the ksession by hand (in the knowledgeBaseUpdated method). But I am hoping there is a cleaner/better way. Thanks for any ideas. -J -- View this message in context: http://drools.46999.n3.nabble.com/KnowledgeAgent-with-persistence-tp4025897.html Sent from the Drools: User forum mailing list archive at Nabble.com. _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
