我有一个带有 POJO 作为当前消息有效负载的 Mule 流。我想通过调用返回的 HTTP REST 服务来丰富消息text/plain
。我尝试了几种不同的方法,但每次都会出错。我当前的流程如下所示:
<foreach doc:name="For Each">
<enricher source="#[message.payload]"
target="#[variable:agentCode]" doc:name="Message Enricher">
<http:outbound-endpoint exchange-pattern="request-response" host="localhost"
port="8080"
path="ods.service/agent/agentCode/#[message.payload.getAgentEntityNumber()]"
method="GET" mimeType="text/plain" doc:name="HTTP"/>
</enricher>
<component class="za.co.sci.mule.agt.MoveVariablesToPayload"
doc:name="Move variables to message"/>
</foreach>
浓缩器之后的组件只是将变量值移动到我的 POJO 中。当我执行此操作时,我得到:
An invalid return type "interface org.mule.api.MuleMessage"
was specified for transformer "JAXBMarshallerTransformer"
这对我来说没有多大意义,但我尝试关闭传输变压器,我得到:
java.lang.ClassCastException: org.mule.transport.http.ReleasingInputStream
cannot be cast to java.lang.Integer
哪种是有道理的,但并没有真正的帮助。
我的问题是,是否可以通过调用简单的text/plain
REST 服务来丰富消息?如果是这样,我如何构建我的浓缩器?
更新
根据下面的建议进行了更改,但仍然相同。完整的堆栈跟踪:
ERROR 2013-10-11 16:01:03,998 [[sci_silica_interface].connector.http.mule.default.receiver.02] org.mule.exception.CatchMessagingExceptionStrategy:
********************************************************************************
Message : An invalid return type "interface org.mule.api.MuleMessage" was specified for transformer "JAXBMarshallerTransformer"
Code : MULE_ERROR-266
--------------------------------------------------------------------------------
Exception stack is:
1. An invalid return type "interface org.mule.api.MuleMessage" was specified for transformer "JAXBMarshallerTransformer" (org.mule.api.transformer.TransformerException)
org.mule.module.xml.transformer.jaxb.JAXBMarshallerTransformer:122 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.api.transformer.TransformerException: An invalid return type "interface org.mule.api.MuleMessage" was specified for transformer "JAXBMarshallerTransformer"
at org.mule.module.xml.transformer.jaxb.JAXBMarshallerTransformer.doTransform(JAXBMarshallerTransformer.java:122)
at org.mule.transformer.AbstractTransformer.transform(AbstractTransformer.java:411)
at org.mule.transformer.AbstractTransformer.transform(AbstractTransformer.java:363)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
org.mule.api.transport.DispatchException: Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=http://localhost:8080/ods.service/agent/agentCode/12345, connector=HttpConnector