Results 1 to 4 of 4

Thread: How to set HTTP outbound gateway connection timeout

  1. #1
    Join Date
    Mar 2007
    Posts
    5

    Default 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. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,029

    Default

    ?? 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 at 01:10 PM.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  3. #3
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,029

    Default

    Sorry; request-timeout was renamed reply-timeout in 2.1.

    My comment above still applies, though (use a request-factory).
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  4. #4
    Join Date
    Mar 2007
    Posts
    5

    Default

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •