[rules-users] drools-server - resource change scanner/notifier

Ross H ross.hall at suncorp.com.au
Tue Mar 15 03:55:31 EDT 2011


The issue seems to be with declared facts. Using POJOs it works OK.

The kbase is being rebuilt and the ksession is updated with new rules.
However any declared facts do not appear to be detected by the rules.

For instance if you have a fact detect rule:

when
  MyFact()
then
  System.out.println("Found myfact");

If you declare the fact in the DRL,  it works first time, but if you modify
the rule in the consequence, and the scanner rebuilds OK, it does not fire.

If the fact is a POJO, it rebuilds and the rule fires.
I suspect this is an issue with declared facts, not the drools server.
For the moment my project will stick with POJOs, but it would be nice to use
declared facts.

Again any thoughts?


Ross H wrote:
> 
> Well this does not quite work.
> 
> Whilst the knowledgebase is rebuilt when changes are detected, requests to
> the drools-server are not firing the rules as expected and a test fact is
> being returned unmodified.
> 
> If new-instance is set to false, then merging of the rules causes errors.
> 
> Any thoughts?
> 
> 
> Ross H wrote:
>> 
>> There have been previous posts on this problem:
>> 
>> http://drools-java-rules-engine.46999.n3.nabble.com/Starting-resource-change-scanner-and-notifier-in-drools-server-td1528921.html
>> 
>> but I was unable to find a resolution, or issue in Jira.
>> 
>> Looking at the code in 5.1.1 (and trunk), I could not find where the
>> polling and notifier services are started. To overcome the problem I have
>> modified the following:
>> 
>> drools-spring-1.0.0.xsd (added a start attribute to
>> resource-change-scanner)
>> xsd:attribute name="start" use="optional" type="xsd:boolean"
>> 
>> ResourceChangeScannerBeanFactory (started service in
>> afterPropertiesSet())
>>     	if (isStart()) {
>>     	  ResourceFactory.getResourceChangeNotifierService().start();
>>     	  ResourceFactory.getResourceChangeScannerService().start();
>>     	}
>> 
>> ResourceChangeScannerDefinitionParser (added start attribute)
>>         factory.addPropertyValue( START,
>>             element.getAttribute( START ) );
>> 
>> It seems to be working quite nicely.
>> Just wondering if this is the right way to go about it, or whether there
>> is a better method.
>> 
>> Regards RossH
>> 
> 


--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/drools-server-resource-change-scanner-notifier-tp2649325p2680972.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list