jboss - How to store new .drl file to BRMS rule engine server? -
i have scenario in project make dynamic rule , store brms rule server. i've try using kiefilesystem write string object become drl file, still cannot store rule rule engine server when open business central.
here code java main class :
// called artifact repository brms server string url = "http://192.168.0.1:8080/business-central/maven2/com/test/1.0/test-1.0.jar"; kieservices ks = kieservices.factory.get(); kierepository kr = ks.getrepository(); urlresource urlresource = (urlresource) ks.getresources().newurlresource(url); urlresource.setusername("username"); urlresource.setpassword("password"); urlresource.setbasicauthentication("enabled"); inputstream = urlresource.getinputstream(); kiemodule kmodule = kr.addkiemodule(ks.getresources().newinputstreamresource(is)); kiefilesystem kfs = ks.newkiefilesystem(); string rule = "package com.test; \n" + "rule \"rule_1\" \n" + "when \n" + "then \n" + "system.out.println(\"rule_1 fired\"); \n" + "end"; kfs.write("src/main/resources/rules/generatedrule.drl", rule); kiebuilder kb = ks.newkiebuilder(kfs).setdependencies(kmodule).buildall();
when run program, cannot find generated rule in rule directory project in business central.
thank you
Comments
Post a Comment