CRISP - setting timeout


I am facing an issue with some REST calls that sometimes after 60 seconds may go in timeout. Since it is not possible to modify this behavior setting a timeout in the server that I am calling, is it possible to set a timeout in some CRISP configuration?



1 Like

Hello Flavio,

Have a look at the configuration options here at the bottom of the page section Configuring Http Connection Pool you can set the property connectionTimeMillisToLive

HTH and kind regards,

1 Like

crisp supports also the Circuit Breaker Pattern [1]



1 Like

I am having a little problem with the configuration for timeout in CRISP.

At the bottom of this page, the documentation states that we can add a new XML config and override the values of timeout as per our need. As far as I understand, this will changes the behavior of all the calls. Is it possible to change the timeout for a specific call without touching the properties for others. Can I set this as a property in the resolver bean definition like resourceDataCache or is there a way to set it before calling resourceServiceBroker.resolve?


Do you mean socket/read timeout configurations such as connectTimeout, connectionRequestTimeout and readTimeout?

Yes, the default HttpClientBuilder bean and HttpComponentsClientHttpRequestFactory bean are shared globally, so changes to the default beans will affect all resource resolvers.
That is, if you override the following bean (id="org.springframework.http.client.ClientHttpRequestFactory") with different settings, it will change the behavior of all resource resolvers.

  <bean id="org.springframework.http.client.ClientHttpRequestFactory"
    <constructor-arg ref="crispHttpClient" />
    <property name="connectTimeout" value="30000" />
    <property name="connectionRequestTimeout" value="30000" />
    <property name="readTimeout" value="30000" />

Yes, you can set a different HttpComponentsClientHttpRequestFactory bean for a specific resource resolver because the default json-based resource resolver, org.onehippo.cms7.crisp.core.resource.jackson.SimpleJacksonRestTemplateResourceResolver extends org.onehippo.cms7.crisp.core.resource.AbstractHttpRequestResourceResolver which exposes the property setter: #setClientHttpRequestFactory(ClientHttpRequestFactory).
Here’s an example setting the timeout values to 1 minutes:

  <bean parent="abstractCrispSimpleJacksonRestTemplateResourceResolver"
    <!-- SNIP -->
    <property name="clientHttpRequestFactory">
      <bean class="org.springframework.http.client.HttpComponentsClientHttpRequestFactory">
        <constructor-arg ref="crispHttpClient" />
        <property name="connectTimeout" value="60000" />
        <property name="connectionRequestTimeout" value="60000" />
        <property name="readTimeout" value="60000" />
    <!-- SNIP -->