我正在尝试在 Mule ESB(企业版)中创建一个流,该流从 WMQ 7.5(xml 有效负载)中的队列接收消息,使用 DataWeave 将其转换(出于我的目的,将其转换为与旧的),然后将其放回另一个队列。我的流程如下:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:wmq="http://www.mulesoft.org/schema/mule/ee/wmq" 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"
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/ee/wmq http://www.mulesoft.org/schema/mule/ee/wmq/current/mule-wmq-ee.xsd
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd">
<wmq:connector (MQ configuration is here, it is not the problem) />
<flow name="dataweaveFlow">
<wmq:inbound-endpoint queue="I0" connector-ref="WMQ" doc:name="WMQ">
<wmq:transaction action="ALWAYS_BEGIN"/>
</wmq:inbound-endpoint>
<set-variable variableName="MULE_REPLYTO_STOP" value="true" doc:name="Variable"/>
<dw:transform-message doc:name="Transform Message">
<dw:input-payload doc:sample="empty_1.xml"/>
<dw:set-payload><![CDATA[%dw 1.0
%input payload application/xml
%output application/xml
---
payload]]></dw:set-payload>
</dw:transform-message>
<wmq:outbound-endpoint queue="O0" connector-ref="WMQ" doc:name="WMQ">
<wmq:transaction action="ALWAYS_JOIN"/>
</wmq:outbound-endpoint>
</flow>
</mule>
我的 DataWeave 配置如下所示: 输入:
<?xml version='1.0' encoding='windows-1252'?>
<empty/>
转型:
%dw 1.0
%input payload application/xml
%output application/xml
---
payload
现在,当我运行这个流程时,我将一条消息放在队列中,Mule 无法处理该消息并不断抛出异常,说:“Invalid mime type application/xml”,异常堆栈为 1. Invalid mime type application/xml (com.mulesoft.weave.mule.exception.InvalidMimeTypeException) com.mulesoft.weave.mule.WeaveMessageProcessor:165 (null) 2. 无效的 mime 类型 application/xml (com.mulesoft.weave.mule.exception.InvalidMimeTypeException )。消息负载的类型为:字符串 (org.mule.api.MessagingException) org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor:32 ( http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/消息异常.html )
无论如何,我对 Mule(当然还有 DataWeave)还很陌生,我们将不胜感激!让我知道是否需要更多详细信息。