Dynamic Drools Endpoint Update in Drools Camel Server

陌路散爱 提交于 2019-12-10 11:45:49

问题


The "User Guide" for Drools 6 states that a camel endpoint for drools shall be in the below format:

<to uri="kie:{1}/{2}" />

where

  • {1}: Execution Node identifier that is registered in the CamelContext
  • {2}: Knowledge Session identifier that was registered in the Execution Node with identifier {1}

Doubt # 1 :

If the sessions are created before the endpoints are built, how the incremental changes in kmodule will be picked up by the sessions created before?

Statement about KScanner from the document:

If the KieScanner finds, in the Maven repository, an updated version of the Kie project used by that KieContainer it automatically downloads the new version and triggers an incremental build of the new project. From this moment all the new KieBases and KieSessions created from that KieContainer will use the new project version.

Doubt # 2

And..I am trying to configure this endpoint to route to ksessions dynamically.

Traversing through the source code, I tried declaring the uri to kie:dynamic and adding new sessions to KieEndpoint.executorsByName, like

KieEndpoint endPoint = (KieEndpoint)camel.getEndpoint("kie:dynamic");
endPoint.executorsByName.put(sessionName, kSession);

Is this the right way of adding the dynamic sessions? I didn't find any hint in user guide for this.

来源:https://stackoverflow.com/questions/24526313/dynamic-drools-endpoint-update-in-drools-camel-server

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