Uploaded image for project: 'Configuration Persistence Service'
  1. Configuration Persistence Service
  2. CPS-1994

Use Apache Http Client for DMI REST requests

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Done
    • Icon: Medium Medium
    • New Delhi Release
    • None
    • NCMP
    • None

      Spring Boot's RestTemplateBuilder will choose a HTTP client to use at runtime depending on what is available on the class path. This can lead to different behaviour (see CPS-1968), for example the Apache client uses connection pooling (with a default limit of 5 connections per host) versus Jetty client which does not use pooling.

      This task is to use Apache client in NCMP and allow it to be configured through Spring application.yml

      public static ClientHttpRequestFactory get(ClientHttpRequestFactorySettings settings) {
      	Assert.notNull(settings, "Settings must not be null");
      	if (APACHE_HTTP_CLIENT_PRESENT) {
      		return HttpComponents.get(settings);
      	}
      	if (JETTY_CLIENT_PRESENT) {
      		return Jetty.get(settings);
      	}
      	if (OKHTTP_CLIENT_PRESENT) {
      		return OkHttp.get(settings);
      	}
      	return Simple.get(settings);
      }

      Reference: https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactories.java#L100

            waqas.ikram waqas.ikram
            danielhanrahan Daniel Hanrahan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: