cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to tell Spring to wait longer for REST response? - OutboundService falsely throws SocketTimeOutException

former_member213564
Participant
0 Kudos
2,886

Hi experts,

I'm using the standard API to export an order to a backend system via SCPI. By standard I mean

  1. Extension: CPI Order Exchange OMS: SapCpiOmsOrderOutboundAction.executeAction()

  2. Extension: CPI Adapter: SapCpiOutboundService.sendOrder()

  3. Extension: Outbound Services: DefaultOutboundServiceFacade.send()

The DefaultOutboundServiceFacade.send() calls internally restTemplate.postForEntity() which throws ResourceAccessException with underlying exception java.net.SocketTimeoutException with message 'Read timed out'. However, the case is that the SCPI sometimes needs a bit more time and in that case I get the exception although SCPI processed everything without any errors.

Is there a way to configure timeout configuration, i.e. to tell Spring to wait a bit more before throwing the exception?

Cheers, Filip

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member213564
Participant

I found the solution. In short, in local.properties set value outboundservices.httpclient.connections.connectionTimeout=0

to override the default value. 0 means that session never times out, which is probably not what you want for your production.

The default value is 20000 and its set in outboundservices-spring.xml

 <alias name="defaultOutboundHttpClientFactory" alias="outboundHttpClientFactory" />
     <bean id="defaultOutboundHttpClientFactory" class="de.hybris.platform.outboundservices.client.impl.DefaultOutboundHttpClientFactory">
         <property name="maxConnections" value="${outboundservices.httpclient.max.connections:5}" />
         <property name="keepAlive" value="${outboundservices.httpclient.connections.keep-alive:60000}" />
         <property name="timeout" value="${outboundservices.httpclient.connections.connectionTimeout:20000}" />
         <property name="validity" value="${outboundservices.httpclient.connections.validity:500}" />
     </bean>

More information at

https://answers.sap.com/questions/12758503/specify-session-timeout.html

&

https://help.sap.com/viewer/d0224eca81e249cb821f2cdf45a82ace/6.2.0.0/en-US/8c005cde86691014a49ce1de2...