Re-loading remote drools guvnor resource at drools-camel-server

风流意气都作罢 提交于 2019-12-10 17:33:59

问题


I am using drools-camel-server 5.4 final to execute the rules fetched from guvnor on jboss AS7 as follows:

    <drools:resource type="PKG" source="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/mypackage/Test"
                            basic-authentication="enabled" username="test" password="test" />
    </drools:resources>
    <drools:ksession id="ksession1" type="stateless" 
            kbase="kbase" node="node1" />

how can I reload or rebuild the knowledgebase so that any changes in the rules instantly get reflected on execution server?


回答1:


Yes you can by adding a knowledge agent and a resource change scanner... here is my working example

<drools:resource-change-scanner id="s1" interval="10" enabled="true"/>
<drools:kagent kbase="kbase1" id="kagent" new-instance="false"/> 

<drools:grid-node id="node1"/>

<drools:ksession id="ksession1" type="stateless" kbase="kbase1" node="node1"/>

<drools:kbase id="kbase1" node="node1">
   <drools:resources>
      <drools:resource  type="DRL" source="classpath:test.drl"/>
   </drools:resources>
</drools:kbase>



回答2:


I had the same issue. Could not find any solution anywhere. I had resulted to trial and error and eventually for what seems to work for me. It detects when my remote resources in Guvnor has been updated.

<drools:resource-change-scanner id="s1" interval="10" enabled="true" />
<drools:resource id="cs" type="CHANGE_SET" source="http://localhost:8080/drools-guvnor/rest/packages/com.test/assets/CHANGE_SET/source" basic-authentication="enabled" username="admin" password="admin" />

<drools:kagent kbase="kbase1" id="kagent" new-instance="false">
    <drools:resources>
        <drools:resource ref="cs" />
    </drools:resources>
</drools:kagent>

<drools:grid-node id="node1"/> 
<drools:ksession id="ksession1" type="stateless" kbase="kbase1" node="node1"/>

<drools:kbase id="kbase1" node="node1">
    <drools:resources>
        <drools:resource ref="cs" />
    </drools:resources>
</drools:kbase>  


来源:https://stackoverflow.com/questions/10852984/re-loading-remote-drools-guvnor-resource-at-drools-camel-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!