我需要每小时拨打一次休息服务。所以我使用了一个poller组件,通过使用http.request来调用其余服务。 但是每次调用我都会得到一个TimeOutException。有没有解决这个问题的方法。这是异常堆栈
<sub-flow name="sf-vessel-operator-update">
<json:json-to-object-transformer returnClass="java.util.HashMap" doc:name="JSON to Object"/>
<set-session-variable variableName="originalPayload" value="#[payload]" doc:name="Session Variable"/>
<foreach collection="#[payload.LINEOPERATORCODE]" doc:name="For Each">
<set-session-variable variableName="LINEOPERATORCODE" value="#[payload]" doc:name="Session Variable"/>
<flow-ref name="sf-vessel-operator-search" doc:name="sf-vessel-operator-search"/>
<flow-ref name="sf-process-update-request" doc:name="sf-process-update-request"/>
</foreach>
</sub-flow>
<sub-flow name="sf-vessel-operator-search">
<logger level="INFO" doc:name="Logger" message="REQUEST RECEIVED TO GET DATA FROM VESSEL_ROUTING WITH THE FOLLOWING DATA : #[payload]"/>
<set-session-variable variableName="IDCONTRACTOR" value="null" doc:name="Session Variable"/>
<set-session-variable variableName="IDLINEOPERATOR" value="null" doc:name="Session Variable"/>
<logger message="IDContractor = #[sessionVars.IDCONTRACTOR]****************IDLINEOPERATOR = #[message.payload.IDLINEOPERATOR]" level="INFO" doc:name="Logger"/>
<enricher target="#[sessionVars.IDCONTRACTOR]" doc:name="me-get-idcontractor">
<processor-chain doc:name="Processor Chain">
<set-payload value="select distinct IDMEMBER from member_industry where chtradingcode='#[sessionVars.originalPayload['TERMINALID']]'" doc:name="Set Payload"/>
<flow-ref name="sf-query-member-industry" doc:name="sf-query-member-industry"/>
</processor-chain>
</enricher>
<enricher doc:name="me-get-lineoperator" target="#[sessionVars.IDLINEOPERATOR]">
<processor-chain doc:name="Processor Chain">
<set-payload value="select distinct IDMEMBER from member_industry where chtradingcode='#[sessionVars.LINEOPERATORCODE]'" doc:name="Set Payload"/>
<flow-ref name="sf-query-member-industry" doc:name="sf-query-member-industry"/>
</processor-chain>
</enricher>
<logger message="IDCONTRACTOR : #[sessionVars.IDCONTRACTOR], IDLINEOPERATOR : #[sessionVars.IDLINEOPERATOR]" level="INFO" doc:name="Logger"/>
<expression-component doc:name="Expression"><![CDATA[String cql3Query = "SELECT * FROM VESSEL_OPERATOR WHERE CHLLOYDSNUMBER = '" + sessionVars.originalPayload['LLOYDSNUMBER'] + "'";
if ( sessionVars.IDCONTRACTOR != null ) {
cql3Query = cql3Query + " and IDCONTRACTOR = '"+sessionVars.IDCONTRACTOR + "'" ;
}
if ( sessionVars.IDLINEOPERATOR != null ) {
cql3Query = cql3Query + " and IDLINEOPERATOR = '"+sessionVars.IDLINEOPERATOR + "'";
}
if ( sessionVars.originalPayload['VOYAGENUMBER'] != null && sessionVars.originalPayload['VOYAGENUMBER'].length() > 0 ) {
cql3Query = cql3Query + " and CHOUTVOYAGENUMBER = '"+sessionVars.originalPayload['VOYAGENUMBER'] +"'";
}
payload = cql3Query ;
]]></expression-component>
<flow-ref name="sf-select-query-database" doc:name="sf-select-query-database"/>
</sub-flow>
<sub-flow name="sf-process-update-request">
<set-variable variableName="status" value="#[message.outboundProperties['http.status']]" doc:name="Variable"/>
<logger message="Status : #[flowVars.status]" level="INFO" doc:name="Logger"/>
<choice doc:name="Choice">
<when expression="#[flowVars.status == '200']">
<expression-component doc:name="Expression"><![CDATA[String cql3Query = " UPDATE VESSEL_OPERATOR SET " ;
if ( sessionVars.LINEOPERATORCODE != null ) {
cql3Query = cql3Query + " CHLINEOPERATORCODE = '"+ sessionVars.LINEOPERATORCODE + "'";
}
if ( sessionVars.originalPayload['LINEOPERATORNAME'] != null ) {
cql3Query = cql3Query + "', CHLINEOPERATORNAME= '"+sessionVars.originalPayload['LINEOPERATORNAME'] + "'";
}
cql3Query = cql3Query + " WHERE IDCONTRACTOR = '" + sessionVars.IDCONTRACTOR + "'" +
" AND CHLLOYDSNUMBER = '" +sessionVars.originalPayload['LLOYDSNUMBER'] + "'" +
" AND CHOUTVOYAGENUMBER = '" +sessionVars.originalPayload['VOYAGENUMBER'] + "'" +
" AND IDLINEOPERATOR = '" + sessionVars.IDLINEOPERATOR + "'" ;
payload = cql3Query;
]]></expression-component>
<flow-ref name="sf-update-query-database" doc:name="sf-update-query-database"/>
</when>
<when expression="#[flowVars.status == '204']">
<expression-component doc:name="Expression"><![CDATA[
flowVars.LINEOPERATORNAME = "null";
if (sessionVars.originalPayload['LINEOPERATORNAME'] != null ) {
flowVars.LINEOPERATORNAME =sessionVars.originalPayload['LINEOPERATORNAME'];
}
String cql =
" INSERT INTO VESSEL_OPERATOR ( IDCONTRACTOR, CHLLOYDSNUMBER, CHOUTVOYAGENUMBER, IDLINEOPERATOR,CHLINEOPERATORCODE," +
"CHLINEOPERATORNAME )" + " VALUES ( " +
"'" + sessionVars.IDCONTRACTOR + "'," +
"'" + sessionVars.originalPayload['LLOYDSNUMBER'] +"',"+
"'" +sessionVars.originalPayload['VOYAGENUMBER']+"',"+
"'" + sessionVars.IDLINEOPERATOR +"',"+
"'" + sessionVars.LINEOPERATORCODE +"',"+
"'" + flowVars.LINEOPERATORNAME +"')";
payload = cql;]]></expression-component>
<flow-ref name="sf-insert-query-database" doc:name="sf-insert-query-database"/>
</when>
<otherwise>
<logger message="Sorry Default executed" level="INFO" doc:name="Logger"/>
</otherwise>
</choice>
</sub-flow>
</mule>