Reputation: 262
I am using drools-guvnor 5.5 for storing rules and modify using drools-guvnor web-gui. I want to create a sample application in java which connect with drools-guvnor and load rules from it and execute in java side. Steps I followed for this as below.
I read in drools-expert documentation that "KnowledgeAgent" is used for connect java application with drools-guvnor but i am not able to find any sample code for that.
Can someone please help me on this issue.
Upvotes: 1
Views: 899
Reputation: 9480
Example code for creating a knowledge agent is in the Drools Expert user guide.
http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html_single/#d0e2239
The following is a commented version of the code found in that section of the manual.
// Create a knowledge agent which will poll a Guvnor URL every 60 secs.
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent( "MyAgent" );
kagent.applyChangeSet( ResourceFactory.newUrlResource( url ) );
// Call this when your application wishes to run rules.
// By calling getKnowledgeBase(), you will get the most recent
// knowledge base from the agent.
KnowledgeBase kbase = kagent.getKnowledgeBase();
Upvotes: 2