我目前正在构建在这里找到的camel-drools示例:https://github.com/FuseByExample/camel-drools-example
路由如下:
<route trace="false" id="testRoute">
<description>Example route that will regularly create a Person with a random age and verify their age</description>
<from uri="timer:testRoute"/>
<bean method="createTestPerson" ref="personHelper"/>
<to uri="drools:node1/ksession1?action=insertBody" id="AgeVerification">
<description>valid 'action' values are:
'execute' that takes a 'Command' object (default)
'insertBody' that inserts the Exchange.in.body, and executes rules
'insertMessage' that inserts the Exchange.in (type org.apache.camel.Message), and executes rules
'insertExchange' that inserts the Exchange (type org.apache.camel.Exchange), and executes rules
</description>
</to>
<choice>
<when id="CanDrink">
<simple>${body.canDrink}</simple>
<log logName="Bar" message="Person ${body.name} can go to the bar"/>
</when>
<otherwise>
<log logName="Home" message="Person ${body.name} is staying home"/>
</otherwise>
</choice>
</route>我已经为我自己的项目扩展了这个例子,并添加了更复杂的规则和不同的事实,我现在想要调试它们,但是我不知道如何让Drools调试在camel / fuse环境中工作。
理想情况下,我希望看到Drools IDE提供的所有不同的调试视图,如议程视图、工作内存视图等(根据http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html/ch06.html#d0e8478)。我已经将Eclipse项目转换为Drools项目。我已经创建了一个新的“Drools应用程序”调试配置,但是不知道要在“main class”部分中放入什么内容。我没有自己的主类,因为是camel调用规则的触发并将事实插入到工作内存中。
我尝试将应用程序作为普通Java应用程序进行调试,因此我在执行应用程序的drools部分之前设置了断点。我遵循了drools的文档,如果你设置了正常的断点,点击workingMemory变量,drools的“工作内存”或“议程”视图应该会填充,但是我总是看到“选定的工作内存是空的”,即使我知道它不是空的。我从头到尾都在单击所有可能的WorkingMemory变量,但我仍然看到“选定的工作内存是空的”错误。
有没有人能够在使用camel部署时成功地调试drools?如果是,你采取了什么步骤?
干杯。
发布于 2013-07-25 23:14:43
我使用KnowledgeRuntimeLogger帮助调试我的camel/drools应用程序。它创建了一个我在Audit视图中查看的日志文件(您可以将其拖动到eclipse中的视图中)。
临时flogger = KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(ksession,“c:/ KnowledgeRuntimeLogger /wmlog”);
如果您需要在spring中执行此操作,则可以使用两个构造函数参数将其创建为bean (或者创建您自己的小bean来创建记录器)。
hth
https://stackoverflow.com/questions/15289538
复制相似问题