[英]How to Solve Message payload is of type: BufferInputStream Exception in Mule
[英]Mule - exception in Outbound endpoint Message payload is of type: byte[]
嗨,您好,ule子中的Https出站終結點,但總是收到一個異常消息,說消息有效負載是字節[]類型
INFO 2014-12-31 12:55:02,699 [[collectFlow] .connector.VM.mule.default.dispatcher.01] org.mule.lifecycle.AbstractLifecycleManager:開頭:'connector.VM.mule.default.dispatcher.12905544 ”。 對象是:VMMessageDispatcher INFO 2014-12-31 12:55:02,699 [[collectFlow] .ScatterGatherWorkManager.01] org.mule.lifecycle.AbstractLifecycleManager:起始:“ IPS-HTTPS-TwoWaySSL-Connector.dispatcher.14325410”。 對象是:HttpsClientMessageDispatcher錯誤2014-12-31 12:55:04,961 [[collectFlow] .collectFlow.stage1.02] org.mule.exception.DefaultMessagingExceptionStrategy:
消息:找到路由(0)的異常。消息有效載荷的類型為:byte []
異常堆棧為:1.發現路由的異常:0。消息有效載荷的類型為:byte [](org.mule.routing.CompositeRoutingException)org.mule.routing.CollectAllAggregationStrategy:51( http:// www .mulesoft.org / docs / site / current3 / apidocs / org / mule / routing / CompositeRoutingException.html )
<scatter-gather doc:name="Scatter-Gather"> <processor-chain> <logger message="Just before calling https" level="INFO" doc:name="Logger"/> <set-property propertyName="Content-Type" value="text/xml" doc:name="Property"/> <https:outbound-endpoint exchange-pattern="request-response" host:"localhost" port:"8080" path="test" method="POST" connector-ref="IPS-HTTPS-TwoWaySSL-Connector" tracking:enable-default-events="true" doc:name="HTTPS" encoding="UTF-8" mimeType="text/xml" contentType="text/xml"/> </processor-chain> <vm:outbound-endpoint exchange-pattern="one-way" doc:name="Logger In Queue" path="FlowIn"/> </scatter-gather>
問題是聚合策略。 由於您沒有定義任何自定義策略,因此Mule使用默認策略(默認聚合器CollectAllAggregationStrategy不處理byte []有效負載)
如果不需要分散消息中的任何信息,只需實施虛擬聚合器策略即可創建to子事件:
流:
<scatter-gather doc:name="Scatter-Gather">
<custom-aggregation-strategy class="org.myproject.DummyAggregationStrategy" />
<processor-chain>
<logger message="Just before calling https" level="INFO" doc:name="Logger"/>
<set-property propertyName="Content-Type" value="text/xml" doc:name="Property"/>
<https:outbound-endpoint exchange-pattern="request-response" host:"localhost" port:"8080" path="test" method="POST" connector-ref="IPS-HTTPS-TwoWaySSL-Connector" tracking:enable-default-events="true" doc:name="HTTPS" encoding="UTF-8" mimeType="text/xml" contentType="text/xml"/>
</processor-chain>
<vm:outbound-endpoint exchange-pattern="one-way"
doc:name="Logger In Queue" path="FlowIn"/>
</scatter-gather>
策略類:
public class DummyAggregationStrategy implements AggregationStrategy {
@Override
public MuleEvent aggregate(AggregationContext context) throws MuleException {
if(context.collectEventsWithoutExceptions().isEmpty())
return new DefaultMuleMessage();
else
return DefaultMuleEvent.copy(context.collectEventsWithoutExceptions().get(0));
}
}
有關更多信息,請查看Scatter-Gather 文檔 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.