0

SAP Cloud SDK OData client provides us a type-safe way to access OData API. However, we are wondering it is possible to configure the different timeout values e.g., connection request timeout, connection timeout and read timeout etc. when we issue OData call in this way like what we do by using RestTemplate or WebClient? And what's the default timeout value for Cloud SDK then? Thanks.

Eric Jiang
  • 567
  • 1
  • 7
  • 20

1 Answers1

0

You can apply a timeout and other resilience patterns via the dedicated Resilience API. Alternatively, or in addition, you can configure the timeout of the underlying http client as described here. The default timeout for the http client is 2 minutes.

MatKuhr
  • 505
  • 4
  • 13
  • Hi MatKuhr, thanks for the reply but how to inject the customized http client into the stub classes generated by SAP Cloud SDK? I don't find a way to change the http client used by SAP Cloud SDK. – Eric Jiang Mar 27 '23 at 01:43
  • The customised factory will be used implicitly by the OData APIs when setting it via `HttpClientAccessor.setHttpClientFactory(factory)`. In case you want to apply different settings for different OData calls you can do this by overriding `getHttpClientBuilder( HttpDestinationProperties destination )`. This will internally be called by the OData code. – MatKuhr Mar 27 '23 at 06:58
  • In case you want to explicitly pass a specific instance of HttpClient to the OData APIs, this is also possible. You can invoke `.toRequest()` on the fluent APIs to obtain a low-level client. There you will find `execute(HttpClient client)`. – MatKuhr Mar 27 '23 at 07:01