【问题标题】:Debugging drools when deployed in camel / fuseesb在camel / fuseesb中部署时调试流口水
【发布时间】:2013-03-08 08:20:37
【问题描述】:

我目前正在建立在这里找到的骆驼流口水示例: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 调试在骆驼/熔丝环境中工作.

理想情况下,我希望看到 Drools IDE 提供的所有各种调试视图,例如议程视图、工作内存视图等(根据 http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html/ch06.html#d0e8478)。我已将我的 Eclipse 项目转换为 Drools 项目。我创建了一个新的“Drools 应用程序”调试配置,但不知道在“主类”部分放什么。我没有自己的主类,因为调用规则的触发并将事实插入工作内存的是骆驼。

我已经尝试将应用程序作为普通 Java 应用程序进行调试,因此我在执行应用程序的 drools 部分之前设置了断点。我遵循了 drools 文档,该文档说,如果您设置正常断点并单击应填充 drools“工作内存”或“议程”视图的 workingMemory 变量,但是我总是看到“选定的工作内存为空”,即使虽然我知道它不是。我已经从头到尾逐步完成了单击所有可能的 WorkingMemory 变量的代码,但我仍然看到“选定的工作内存为空”错误。

有没有人能够在使用骆驼部署时成功调试流口水?如果是,您采取了哪些步骤?

干杯。

【问题讨论】:

  • 请注意,6.0.0-SNAPSHOT 正在围绕 osgi、camel 和 karaf 改进进行工作。
  • 嗨,我不确定这个问题的答案;但我很想看看你用 drools 做了什么 :) 它是开源的吗?

标签: apache-camel drools fuseesb spring-dm


【解决方案1】:

我使用 KnowledgeRuntimeLogger 来帮助调试我的 camel/drools 应用程序。它会创建一个我在 Audit 视图中查看的日志文件(您可以将它拖到 eclipse 中的视图中)。

KnowledgeRuntimeLogger flogger = KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(ksession,"c:/temp/wmlog");

如果您需要在 spring 中执行此操作,您可以将其创建为带有两个构造函数参数的 bean(或创建您自己的用于创建记录器的小 bean)。

【讨论】:

    猜你喜欢
    • 2013-01-31
    • 1970-01-01
    • 1970-01-01
    • 2012-08-17
    • 2017-08-31
    • 2018-11-24
    • 1970-01-01
    • 2010-12-30
    • 2013-02-01
    相关资源
    最近更新 更多