[jboss-jira] [JBoss JIRA] (DROOLS-3090) KieScanner does not work as expected
Ales Dolecek (Jira)
issues at jboss.org
Wed Oct 10 04:32:00 EDT 2018
[ https://issues.jboss.org/browse/DROOLS-3090?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13645740#comment-13645740 ]
Ales Dolecek commented on DROOLS-3090:
--------------------------------------
I have same problem. Everything works when I test it. It replaces released rules and works fine. But after few days when it really matters it does not work. The system is running 24/7 and during day processes about 1500 sessions per hour, usually submitted in small "chunks".
We check for changes every 5 minutes.
*I think that it breaks when the check/change occurs during processing*, but can't prove it as it depends on synchronization which is out of my control. The issue happens rarely - but that is maily because the system might be dunning weeks without actual update of the rules. And then when the change is made and it turns out that it is not applied it is impossible to trace back lifetime of the system.
We get new sessions like this:
{code}
KieSession session = kbase.newKieSession();
try {
RulesListener listener = new RulesListener(LOG);
session.addEventListener((AgendaEventListener) listener);
session.addEventListener((RuleRuntimeEventListener) listener);
session.setGlobal("backend", backend);
for (Object fact : facts)
session.insert(fact);
session.fireAllRules();
session.insert(Stage.META_DATA);
session.fireAllRules();
session.insert(Stage.FULL_TEXT);
session.fireAllRules();
for (Object fact : session.getObjects()) {
if (fact instanceof UserData) {
UserData kvp = (UserData) fact;
@Nullable String value = kvp.getValue();
if (value != null)
result.put(kvp.getKey(), value);
}
}
@Nullable String rule = listener.getDemandTypeRule();
if (rule != null)
result.put("AM_RuleName", rule);
} finally {
session.dispose();
}
{code}
eg. we keep the kbase "forever" - but that should be OK.
We had similiar problem back in version 5.5 (DROOLS-215) and I hoped that this whole new aproach will help.
Is there any description how this whole Scanner thing is actually implemented? I suppose you must use hierarchical classloader?
---
I'll try to implement wrapped arounf kbase, that will create brand new kbase after seeing event UPDATING from ScannerListener.
> KieScanner does not work as expected
> ------------------------------------
>
> Key: DROOLS-3090
> URL: https://issues.jboss.org/browse/DROOLS-3090
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Affects Versions: 7.8.0.Final
> Reporter: Ales Dolecek
> Assignee: Mario Fusco
> Priority: Major
> Attachments: kmodule.xml, spring.xml
>
>
> We have published nee version of rules:
> {noformat}
> 2018-10-09 10:44:58,785 INFO [Timer-2][] ScannerListener Knowledge base scanner SCANNING
> 2018-10-09 10:44:59,019 INFO [Timer-2][] ScannerListener Knowledge base scanner UPDATING
> 2018-10-09 10:45:00,236 INFO [Timer-2][] KieRepositoryImpl KieModule was added: ZipKieModule[releaseId=cz.dimensiondata.o2:offline-rules:0.0.20,file=F:\GCTI8\assign_manager_2\repository\cz\dimensiondata\o2\offline-rules\0.0.20\offline-rules-0.0.20.jar]
> 2018-10-09 10:45:00,345 INFO [Timer-2][] KieScanner The following artifacts have been updated: {cz.dimensiondata.o2:offline-rules:0.0.19=cz.dimensiondata.o2:offline-rules:jar:0.0.20}
> 2018-10-09 10:45:00,345 INFO [Timer-2][] ScannerListener Knowledge base scanner RUNNING
> 2018-10-09 10:45:00,345 INFO [Timer-2][] ScannerListener Knowledge base scanner RUNNING
> {noformat}
> As you can see the jar got downloaded to local M2 repository and replace. Yet drools still uses old rules.
> We have 3 artefacts:
> offline-facts - with classes inserted into operation memory
> offline-rules - with rules in 1 DRL file and 2 XLSX file
> offline-server - with the application code
> offline-server depend on offline-facs (so it can create new insances)
> offline-rules depend on offline-facts as well, but with provided scope (so the one on classpath is used)
> I have found that Maven has its own caching mechanism so even if new version is published it wont check remote repository more ften than once a day. This can be solved by setting update policy to always.
> {code}
> <repositories>
> <repository>
> <id>public</id>
> <name>Public Repositories</name>
> <url>https://example.org/nexus/content/groups/public/</url>
> <releases>
> <updatePolicy>always</updatePolicy>
> </releases>
> <snapshots>
> <updatePolicy>always</updatePolicy>
> </snapshots>
> </repository>
> </repositories>
> {code}
> Everything seems configred correctly. Fragments of spring configuration are added.
> I'm bit confused what the message:
> {code}
> The following artifacts have been updated: {cz.dimensiondata.o2:offline-rules:0.0.19=cz.dimensiondata.o2:offline-rules:jar:0.0.20}
> {code}
> actually means.
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
More information about the jboss-jira
mailing list