Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

275
Vistas
Persistent connections / Connection reuse using Spring Integration client

I am making REST calls using Spring Integration as below.

<int:gateway id="ServiceRequestGateway"
                 service-interface="com.company.security.integration.RequestGateway"
                 default-request-channel="RequestChannel"
                 default-reply-channel="ResponseChannel">
        <int:default-header name="Accept" value="application/json; v=5"/>
        <int:default-header name="Content-Type" value="application/json; v=5"/>
        <int:default-header name="ServiceType" expression="#args[1]"/>
    </int:gateway>

    <int-http:outbound-gateway
            id="Outbound_Gateway"
            request-channel="RequestChannel"
            reply-channel="ResponseChannel"
            header-mapper="headerMapper"
            url="${service.host}/{xyzServiceType}"
            http-method="POST"
            expected-response-type="java.lang.String"
            extract-request-payload="true">
        <int-http:uri-variable name="ServiceType" expression="headers['xyzServiceType']" />
    </int-http:outbound-gateway>

However there are lot of ssl handshake happening every call over the network. How can I reuse a connection and make multiple REST requests? Is it possible to use keep-alive?

Update-1

Added use of HttpComponentsClientHttpRequestFactory.

<int-http:outbound-gateway
        id="NPI_Tokenization_Outbound_Gateway"
        request-channel="NPITokenizationRequestChannel"
        reply-channel="ResponseChannel"
        header-mapper="headerMapper"
        url="${npi.turing.host}/{npiTuringType}"
        http-method="POST"
        expected-response-type="java.lang.String"
        extract-request-payload="true">
    <int-http:uri-variable name="npiTuringType" expression="headers['npiTuringType']" />
</int-http:outbound-gateway>

<bean id="requestFactory"
      class="org.springframework.http.client.HttpComponentsClientHttpRequestFactory">
    <property name="connectTimeout" value="5000"/>
    <property name="readTimeout"    value="5000"/>
</bean>
about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Consider to use HttpComponentsClientHttpRequestFactory instead of default SimpleClientHttpRequestFactory. In the Apache HTTP Client you can find enough options for connection management, including keep-alive: https://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda