We're using Drools 5.0.1.SNAPSHOT 26353:26357M in JBoss 4.2.3. We're
still in UAT so we've got our rules in Guvnor so that the business
analysts can deploy changes quickly, they create snapshots in Guvnor
that are picked up by the application. The problem is that sometimes
creating a snapshot in Guvnor means that the ResourceChangeScanner in
the application removes the changeset for the rule package that has changed.
Here is the changeset config:
<change-set
xmlns="http://drools.org/drools-5.0/change-set"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-5.0/change-set.xsd" >
<add>
<resource
source="http://localhost/drools-guvnor/org.drools.guvnor.Guvnor/package/cover/cover"
type="PKG" />
<resource
source="http://localhost/drools-guvnor/org.drools.guvnor.Guvnor/package/question/question"
type="PKG" />
<resource
source="http://localhost/drools-guvnor/org.drools.guvnor.Guvnor/package/referral/referral"
type="PKG" />
<resource
source="http://localhost/drools-guvnor/org.drools.guvnor.Guvnor/package/validation/validation"
type="PKG" />
</add>
</change-set>
These are picked up OK when the application starts (I've elided the
timestamps from the log file entries for readability):
KnowledgeAgent building resource=[UrlResource
path='http://localhost/drools-guvnor/org.drools.guvnor.Guvnor/package/validation/validation']
KnowledgeAgent adding KnowledgeDefinitionsPackage validation
KnowledgeAgent building resource=[UrlResource
path='http://localhost/drools-guvnor/org.drools.guvnor.Guvnor/package/question/question']
KnowledgeAgent adding KnowledgeDefinitionsPackage question
KnowledgeAgent building resource=[UrlResource
path='http://localhost/drools-guvnor/org.drools.guvnor.Guvnor/package/referral/referral']
KnowledgeAgent adding KnowledgeDefinitionsPackage referral
KnowledgeAgent building resource=[UrlResource
path='http://localhost/drools-guvnor/org.drools.guvnor.Guvnor/package/cover/cover']
KnowledgeAgent adding KnowledgeDefinitionsPackage cover
KnowledgeAgent new KnowledgeBase now built and in use
And the ResourceChangeScanner then scans for changes every 60 seconds:
ResourceChangeScanner attempt to scan 4 resources
ResourceChangeScanner thread is waiting for 60
When we change the "referral" package and rebuild the snapshot so that
the application can pick it up, here's what happens:
ResourceChangeScanner removed resource=[UrlResource
path='http://localhost/drools-guvnor/org.drools.guvnor.Guvnor/package/referral/referral']
ResourceChangeNotification received ChangeSet notification
ResourceChangeScanner thread is waiting for 60
ResourceChangeNotification processing ChangeSet
ResourceChangeNotification ChangeSet removed resource=[UrlResource
path='http://localhost/drools-guvnor/org.drools.guvnor.Guvnor/package/referral/referral']
for listener=org.drools.agent.impl.KnowledgeAgentImpl@7a1b5b
KnowledgeAgent received ChangeSet changed notification
KnowledgAgent applying ChangeSet
KnowledgeAgent unsubscribing from resource=[UrlResource
path='http://localhost/drools-guvnor/org.drools.guvnor.Guvnor/package/referral/referral']
ResourceChangeNotification unsubscribing
listener=org.drools.agent.impl.KnowledgeAgentImpl@7a1b5b to
resource=[UrlResource
path='http://localhost/drools-guvnor/org.drools.guvnor.Guvnor/package/referral/referral']
KnowledgeAgent ChangeSet requires KnowledgeBuilder
KnowledgeAgent ChangeSet requires KnowledgeBuilder
KnowledgeAgent ChangeSet requires KnowledgeBuilder
KnowledgeAgent rebuilding KnowledgeBase using ChangeSet
ResourceChangeNotification thread is waiting for queue update
KnowledgeAgent building resource=[UrlResource
path='http://localhost/drools-guvnor/org.drools.guvnor.Guvnor/package/validation/validation']
KnowledgeAgent adding KnowledgeDefinitionsPackage validation
KnowledgeAgent building resource=[UrlResource
path='http://localhost/drools-guvnor/org.drools.guvnor.Guvnor/package/question/question']
KnowledgeAgent adding KnowledgeDefinitionsPackage question
KnowledgeAgent building resource=[UrlResource
path='http://localhost/drools-guvnor/org.drools.guvnor.Guvnor/package/cover/cover']
KnowledgeAgent adding KnowledgeDefinitionsPackage cover
KnowledgeAgent new KnowledgeBase now built and in use
ResourceChangeScanner attempt to scan 3 resources
ResourceChangeScanner thread is waiting for 60
From this point on it seems to be impossible to get the
ResourceChangeScanner to pick up the new "referral" snapshot. I've tried
updating the changeset file and redeploying the snapshot but the
application won't pick it up. This problem doesn't occur with every
snapshot rebuild but it does happen quite frequently.
Has anyone else struck this problem? Is there any way around it?
Cheers
Peter Butler