[rules-users] Detect changes in rules at runtime

kitc25 chankia at ubs.com
Tue Jul 7 16:19:36 EDT 2009


Hello,

Yes, is it possible to detect the changing in rules in Java and to
re-generate the newest knowledge package, go visit the Droosl Expert
documentation from Jboss, in the KnowledgeAgent section.

Kit

rviswanathan wrote:
> 
> Hi 
> 
> I am using Guvnor for editing my business rules. I am able to write a test
> program in java that would fire one sample rule that I have created in
> guvnor. 
> 
> public static final void main(String[] args) {
> 	try {
> 
> 		// load up the knowledge base
> 		//KnowledgeBase kbase = readKnowledgeBase();
> 		KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent(
> "MyAgent" );
>         		kagent.applyChangeSet(
> 		ResourceFactory.newFileResource("C:/Test/changeset.xml"));
> 		KnowledgeBase kbase1 = kagent.getKnowledgeBase(); 
> 		StatefulKnowledgeSession ksession = 
>                                kbase1.newStatefulKnowledgeSession();
> 		Message message = new Message();
> 		message.setMessage("Hello World");
> 		message.setStatus(Message.HELLO);
> 		ksession.insert(message);
> 		ksession.fireAllRules();
> 		ksession.dispose();
> 	}
> 	catch (Exception ex) {
> 			ex.printStackTrace();
> 	}
> }
> 
> Now I am trying to see if I would be able to detect changes in the rules
> that I edit in Guvnor at runtime. What I am trying to do is to edit one of
> the rules and save it, and I need this change to be picked up
> automatically by my java application.
> 
> Is this possible? How do I do this? 
> 
> Thanks 
> Ram
> 

-- 
View this message in context: http://www.nabble.com/Detect-changes-in-rules-at-runtime-tp24379025p24380607.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list