I am facing some chellenge while setting the timeout for the soap request to ESB interface from my interface(Using spring integration). While sending the request to ESB interface, I am setting the request timeout = 5000ms and reply timeout = 5000ms but in case the services is down on ESB interface, the request is not timeout in the desired timeout time of 5000ms(5 sec) and timeout sometimes in 40sec or more. I tried to use the default request timeout and default reply timeout options also with the int:gateway configuration but the same issue. Please see the below configuration done:
<int:gateway id="SoapESBGateway"
service-interface="test.soap.service.ServiceSoap">
<int:method name="ServiceResponse"
request-channel="RequestChannel" reply-channel="ReplyChannel"
request-timeout="5000" reply-timeout="5000" />
</int:gateway>
<int:chain input-channel="RequestChannel" output-channel="ReplyChannel">
<int-xml:marshalling-transformer marshaller="marshaller" result-transformer="resultTransformer"></int-xml:marshalling-transformer>
<int:transformer ref="TransformerBean" method="transformMethod"></int:transformer>
<int-ws:outbound-gateway id="ws-SoapESB-gateway" ignore-empty-responses="true" uri="${soap.URI}"></int-ws:outbound-gateway>
<int:transformer ref="TransformerBean" method="transformMethod"></int:transformer>
<int-xml:unmarshalling-transformer unmarshaller="marshaller"></int-xml:unmarshalling-transformer>
</int:chain>
<bean id="resultTransformer" class="org.springframework.integration.xml.transformer.ResultToStringTransformer" />
<bean id="TransformerBean" class="test.TransformerImpl"></bean>
Please let me know if I am missing something while setting the timeout option.
Thanks, Vinay A
updated:
<int:gateway id="SoapESBGateway"
service-interface="test.soap.service.ServiceSoap">
<int:method name="ServiceResponse"
request-channel="RequestChannel" reply-timeout="5000" />
</int:gateway>
<int:chain input-channel="RequestChannel">
<int-xml:marshalling-transformer marshaller="marshaller" result-transformer="resultTransformer"></int-xml:marshalling-transformer>
<int:transformer ref="TransformerBean" method="transformMethod"></int:transformer>
<int-ws:outbound-gateway id="ws-SoapESB-gateway" ignore-empty-responses="true" uri="${soap.URI}" message-sender="messageSender"></int-ws:outbound-gateway>
<int:transformer ref="TransformerBean" method="transformMethod"></int:transformer>
<int-xml:unmarshalling-transformer unmarshaller="marshaller"></int-xml:unmarshalling-transformer>
</int:chain>
<bean id="resultTransformer" class="org.springframework.integration.xml.transformer.ResultToStringTransformer" />
<bean id="TransformerBean" class="test.TransformerImpl"></bean>
<bean id ="messageSender" class="org.springframework.ws.transport.http.HttpComponentsMessageSender">
<property name="connectionTimeout" value="2000"></property>
</bean>
As above, I have added messageSender bean reference with the int-ws:outbound-gateway and set the property connectiontimeout = 2sec but I can still see that this is waiting around for 19sec for first hit when network is down and for the next hits, less then 19 sec but not the desired timeout for the first hit at least. So do we not have any option where we may ascertain that the desired timeout work always.
Thanks, Vinay