[rules-users] Detect changes in rules at runtime

rviswanathan v_ramakrishnan at hotmail.com
Tue Jul 7 15:13:20 EDT 2009


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-tp24379025p24379025.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list