Java “面向”;严格模式下的非限定类型:MessageExchangePattern“;在尝试将Mule与Drools整合时

Java “面向”;严格模式下的非限定类型:MessageExchangePattern“;在尝试将Mule与Drools整合时,java,mule,drools,esb,Java,Mule,Drools,Esb,我正在尝试将mule与drools集成,我主要遵循了这里的教程,但我遇到了以下错误: (1,22)严格模式下的非限定类型:MessageExchangePattern (1,30)严格模式下的不合格类型:单向' 我似乎不可能找到解决办法,有人能帮我吗?谢谢 这是我的.drl文件: global org.mule.module.bpm.MessageService mule; 导入com.hamgam.hit.esb.* rule "La Vita Ebela" dialect "mvel"

我正在尝试将mule与drools集成,我主要遵循了这里的教程,但我遇到了以下错误:

  • (1,22)严格模式下的非限定类型:MessageExchangePattern
  • (1,30)严格模式下的不合格类型:单向'
我似乎不可能找到解决办法,有人能帮我吗?谢谢

这是我的.drl文件:

global org.mule.module.bpm.MessageService mule;
导入com.hamgam.hit.esb.*

rule "La Vita Ebela"
dialect "mvel"

when
    $x:XMLDTO( inputXML == "inputXML" )
then
    mule.generateMessage("emc",  "KeyValueMatched", null, MessageExchangePattern.ONE_WAY);
end
这是骡子流:

 <?xml version="1.0" encoding="UTF-8"?>

<mule 
xmlns:bpm="http://www.mulesoft.org/schema/mule/bpm"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.6.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/bpm http://www.mulesoft.org/schema/mule/bpm/3.6/mule-bpm.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.6/mule-vm.xsd ">
    <http:listener-config name="HTTP_Listener_Configuration"
        host="localhost" port="8084" doc:name="HTTP Listener Configuration" />

        <spring:beans>
            <spring:bean id="dto" class="com.hamgam.hit.esb.XMLDTO" scope="singleton" />
            <spring:bean id="dto-convertor" class="com.hamgam.hit.esb.XMLToDTO" scope="singleton" />
            <spring:bean id="rule-convertor" class="com.hamgam.hit.esb.RuleXMLToDRL" scope="singleton" />           
        </spring:beans>

        <bpm:drools />

    <flow name="basic_tutorialFlow">
        <http:listener config-ref="HTTP_Listener_Configuration" path="/{name}" doc:name="HTTP" />
        <vm:endpoint name = "emc" path="drool.msg" />
        <set-variable  variableName="name" value="#[message.inboundProperties['http.uri.params']['name']]" />       
        <set-variable variableName="msg" value="#[payload]"/>

        <logger level="DEBUG" doc:name="Logger" message="Current path is flowVars['name']" />

        <expression-component>
            app.registry['dto'] = app.registry['dto-convertor'].convert(flowVars['name']);
        </expression-component> 

        <bpm:rules rulesDefinition="rule.drl" cepMode="true" initialFacts-ref="dto" entryPoint="XMLDTO stream" />

        <choice doc:name="Choice">
            <when expression="#[flowVars.emc == 'KeyValueMatched']">
                <set-payload doc:name="Set Payload" value="#['KeyValueMatched! You are with us on 8084. ' + flowVars['name'] + '. Today is ' + server.dateTime.format('dd/MM/yy') + '.' ]" />
            </when>
            <otherwise>
                <set-payload doc:name="Set Payload" value="#['Nothing! You are with us on 8084. ' + flowVars['name'] + '. Today is ' + server.dateTime.format('dd/MM/yy') + '.' ]" />
            </otherwise>
        </choice>

    </flow>
</mule>

app.registry['dto']=app.registry['dto-convertor'].convert(flowVars['name']);
您需要:

import org.mule.MessageExchangePattern

否则,Drools MVEL脚本将不知道MessageExchangePattern.ONE是什么。

是的,你是对的。我添加了这一行,现在我面临mule的另一个问题:org.mule.api.lifecycle.LifecycleException:无法处理事件,因为“connector.VM.mule.default”已停止。您的mule xml有点不正确,您不能在流中使用。你的Mule上下文可能没有设置好。实际上,在创建本文之前,我把它放在了流中。它以前是在水流之外的。但是没有起作用。我只是想把drools给mule的一些文本返回。