Announcement Announcement Module
Collapse
No announcement yet.
How to set HTTP outbound gateway connection timeout Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to set HTTP outbound gateway connection timeout

    I need to set reply timeout for the http outbound gateway. Following is the configuration I used for the gateway;

    HTML Code:
    <int-http:outbound-gateway id="outGateway"
    		request-channel="outChannel" url="${out.url}"
    		http-method="POST" extract-request-payload="true"
    		expected-response-type="java.lang.String" charset="UTF-8"
    		request-timeout="30000" reply-channel="replyChannel" />
    I was expecting the request-timeout here would do the job. But I found that the connection was held until the third party releases it. In my test scenario, the gateway timeout was 30 secs and the third party url responds only after 60 seconds.

    Spring Integration: 2.0.5.RELEASE
    Spring: 3.1.0.RELEASE

    Could someone please explain the usage of request-timeout? Also how should the reply timeout be handled properly?

    Thanks in advance.

    Sameera

  • #2
    ?? There is no request-timeout on the gateway. If you mean reply-timeout, that is the time we allow when sending the reply to the reply-channel. Normally only meaningful if the reply channel is a bounded queue.

    You need to add a request-factory attribute, and use it to reference a bean of that type that is configured with a read timeout...

    Code:
    <bean id="requestFactory" class="org.springframework.http.client.SimpleClientHttpRequestFactory">
    	<property name="readTimeout" value="30000"/>
    </bean>
    You can also use a CommonsClientHttpRequestFactory if you need authentication etc.
    Last edited by Gary Russell; Jan 26th, 2012, 02:10 PM.

    Comment


    • #3
      Sorry; request-timeout was renamed reply-timeout in 2.1.

      My comment above still applies, though (use a request-factory).

      Comment


      • #4
        Thanks a lot for instructions. I've mistook the request-timeout attribute.

        Comment

        Working...
        X