目前我有一个带有实现“Fork and Join Pattern”的流程,其中并行调用相同的服务5次。当服务没有获得此信息时返回一个soap错误。当我测试“Fork and Join”服务时,如果其中一个调用不满意,则会失败。如何忽略获取数据以防止主服务失败的服务异常(跳过)?
这是我的流程。
<mulexml:namespace-manager includeConfigNamespaces="true">
<mulexml:namespace prefix="sol" uri=".." />
</mulexml:namespace-manager>
主要流程
<flow name="flow1" doc:name="flow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="3048" doc:name="HTTP" path="path"/>
<object-to-string-transformer doc:name="Object to String"/>
<logger message="step 1: #[message:payload]" level="INFO" doc:name="Logger"/>
<set-session-variable variableName="var" value="#[message.payload.substring(message.payload.indexOf('string')+4,message.payload.indexOf('string')+16)]" doc:name="var"/>
<set-variable variableName="var2" value="#[message.payload.substring(message.payload.indexOf('string')+4,message.payload.indexOf('string')+16)]" doc:name="svar"/>
<cxf:jaxws-service serviceClass="Class" doc:name="SOAP"/>
<request-reply timeout="60000">
<vm:outbound-endpoint path="parallel.processor.queue">
<message-properties-transformer scope="outbound">
<delete-message-property key="MULE_REPLYTO" />
</message-properties-transformer>
</vm:outbound-endpoint>
<vm:inbound-endpoint path="join.queue" >
</vm:inbound-endpoint>
</request-reply>
fork join flow
<flow name="fork_join_flow" doc:name="fork_join_flow">
<vm:inbound-endpoint path="parallel.processor.queue" exchange-pattern="one-way" doc:name="VM"/>
<set-property propertyName="MULE_CORRELATION_GROUP_SIZE" value="5" doc:name="Property"/>
<all doc:name="All">
<async doc:name="Async">
<set-property propertyName="MULE_CORRELATION_SEQUENCE" value="1" doc:name="Property"/>
<set-payload value="payload" doc:name="Set Payload"/>
<flow-ref name="f1" doc:name="f1"/>
</async>
<async doc:name="Async">
<set-property propertyName="MULE_CORRELATION_SEQUENCE" value="2" doc:name="Property"/>
<set-payload value="payload" doc:name="Set Payload"/>
<flow-ref name="f2" doc:name="f2"/>
</async>
<async doc:name="Async">
<set-property propertyName="MULE_CORRELATION_SEQUENCE" value="3" doc:name="Property"/>
<set-payload value="payload" doc:name="Set Payload"/>
<flow-ref name="f3" doc:name="f3"/>
</async>
<async doc:name="Async">
<set-property propertyName="MULE_CORRELATION_SEQUENCE" value="4" doc:name="Property"/>
<set-payload value="payload" doc:name="Set Payload"/>
<flow-ref name="f4" doc:name="f4"/>
</async>
<async doc:name="Async">
<set-property propertyName="MULE_CORRELATION_SEQUENCE" value="5" doc:name="Property"/>
<set-payload value="payload" doc:name="Set Payload"/>
<flow-ref name="f5" doc:name="f5"/>
</async>
</all>
</flow>
Subflow - Web Services Invokers
<sub-flow name="f1" doc:name="f1">
<http:outbound-endpoint exchange-pattern="request-response" method="POST" doc:name="HTTP" address="http://localhost:1040/io/gob/ve/buscaTripletaPorSujeto">
<set-property propertyName="Content-Type" value="text/xml" doc:name="Property"/>
<cxf:jaxws-client doc:name="SOAP" operation="Operation" clientClass="Class" port="Port" wsdlLocation="wsdl"/>
</http:outbound-endpoint>
<custom-transformer class="Transformer" doc:name="tra" returnClass="Class"/>
<set-variable variableName="var2" value="#[message:payload]" doc:name="Variable"/>
<flow-ref name="join1" doc:name="Flow Reference"/>
</sub-flow>
<sub-flow name="f2" doc:name="f2">
...
</sub-flow>
<sub-flow name="f3" doc:name="f3">
...
</sub-flow>
<sub-flow name="f4" doc:name="f4">
...
</sub-flow>
<sub-flow name="f5" doc:name="f5">
...
</sub-flow>
加入流程
<sub-flow name="join1" doc:name="join1">
<logger message="entro en join" level="INFO" doc:name="Logger"/>
<collection-aggregator timeout="6000" failOnTimeout="true" doc:name="Collection Aggregator"/>
<combine-collections-transformer />
<logger level="INFO" message="Continuing processing of: #[message.payloadAs(java.lang.String)]" doc:name="Logger"/>
<logger message="tipo de salida final: #[message:payload]" level="INFO" doc:name="Logger"/>
<scripting:transformer doc:name="Soap Response">
<scripting:script engine="Groovy"><![CDATA[
import ...;
import ...;
import java.util.*;
ICollection o = new ICollection();
ArrayList<String> s = new ArrayList<String>();
s = message.payload;
println s[1].getM();
o.setR(s[1].getI());
o.setC(s.size());
o.setS(message.payload);
return o
]]></scripting:script>
</scripting:transformer>
<vm:outbound-endpoint path="join.queue" doc:name="VM">
</vm:outbound-endpoint>
</sub-flow>
事先感谢你的帮助。