Drools 6.4 KieScanner : How create and add Jar with rules in Maven? -
i beginner drools , maven , facing problem load rules kiescanner.
the aim of project able dynamically load rules in permanent kiesession. wonder if possible manage rules kiefilesystem (not sure possible without dispose of session , starting 1 leading lack of previous inserted facts), way use kiescanner.
it seems requires creation of jar containing rules , having maven id (releaseid), not find detailed documentation creation of these jar files.
which files shall included in such jar ? drl files, pom.xml , manifest.mf ?
where can jar file added ? according documentation should not added in classpath when detection of new issues of file necessary : "once module on classpath, no other version may loaded dynamically".
is maven command needed ?
can give me information on points or give me link creation , deployment of such jar , management in kiescanner described ? lot.
here example of stateless kiesession
using kjar maven repository (code in scala, sure you'll idea of program in java)
private val services = kieservices.factory.get private val releaseid = services.newreleaseid("com.piedpiper", "demo", "[1.0,2)") private val kiecontainer = services.newkiecontainer(releaseid) val kscanner = services.newkiescanner(kiecontainer) kscanner.start(2000l) val kiesession = kiecontainer.newstatelesskiesession("simplesession") @tailrec def check() { val (aname, aage) = scala.io.stdin.readf2("{0} {1,number}") val applicant = applicant(name = aname.asinstanceof[string], age = aage.asinstanceof[long].toint, pass = false) kiesession.execute(applicant) println(s"valid ${applicant.pass}") check() } check()
this looks kjar using maven gav com.piedpiper:demo:[1.0,2)
(iow version 1.0
2
(non-inclusive). checks every 2 seconds if new version within range available.
the kjar contains knowledge resources, kmodule.xml
etc (a proper kjar compiled rules using kie-maven-plugin
plugin-extension ). in case contains fact model (i separate out in different maven artefact.)
the rule used in example above
rule "is of valid age" when $a : applicant( age > 13, pass==false ) modify($a){ pass = true } end
when changing rule example > 15
, takes 2 seconds become operational.
Comments
Post a Comment