Scatter Gather Mule异常:getPayloadAsString(),使用getPayloadAsString(DataType.STRING_DATA_TYPE)

时间:2017-06-06 14:18:04

标签: mule scatter payload

我正在使用Scatter Gather(组件mule esb)女巫包含许多Saleforce调用,在Scatter Gather procces之后我获得了以下激励:

java.lang.UnsupportedOperationException : getPayloadAsString(), use getPayloadAsString(DataType.STRING_DATA_TYPE)

默认情况下,Scatter Gather组件的配置为

有我的xml配置

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


<mule xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" 
xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" 
xmlns:sfdc="http://www.mulesoft.org/schema/mule/sfdc" 
xmlns:http="http://www.mulesoft.org/schema/mule/http" 
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/http 
http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd

http://www.mulesoft.org/schema/mule/sfdc 
http://www.mulesoft.org/schema/mule/sfdc/current/mule-sfdc.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/ee/dw 
http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd">

<flow name="Test1">

<http:listener config-ref="httpListenerConfig" path="/test1" doc:name="HTTP" 
allowedMethods="POST"/>

<dw:transform-message doc:name="Transform Message">

<dw:set-payload><![CDATA[%dw 1.0

%output application/java

—

payload]]></dw:set-payload>

</dw:transform-message>

<logger level="INFO" doc:name="Logger" message="Before Scatter Gather"/>

<scatter-gather doc:name="Scatter-Gather">

<processor-chain>

<sfdc:query config-ref="Salesforce__Basic_Authentication" query="Query 
code....."/>

<logger level="INFO" doc:name="Logger" message="Call Saleforce Number 1"/>

</processor-chain>

<processor-chain>

<sfdc:query config-ref="Salesforce__Basic_Authentication" query="Query 
code....."/>

<logger level="INFO" doc:name="Logger" message="Call Saleforce Number 2"/>

</processor-chain>

...
...

</scatter-gather>
<logger level="INFO" doc:name="Logger" message="After Scatter Gather"/>

<foreach doc:name="For Each">

<logger level="INFO" doc:name="Logger" message="First ForEach"/>

<foreach doc:name="For Each">

<logger level="INFO" doc:name="Logger" message="Second ForEach"/>

<flow-ref name="flowRefTest1" doc:name="flowRefTest1"/>

</foreach>

</foreach>

</flow>

</mule>

任何想法如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

这种输出的原因是因为开头的http端点没有得到正确的显示响应,所以尝试以适当的格式设置有效负载,说明完成对Salesforce的所有调用后的完成。 希望这有帮助