Class CommonExternalServiceConnectionAutoConfiguration

java.lang.Object
com.broadleafcommerce.common.extension.webclient.autoconfigure.external.CommonExternalServiceConnectionAutoConfiguration

@AutoConfiguration @ConditionalOnWebApplication(type=SERVLET) @ConditionalOnClass({org.springframework.web.reactive.function.client.WebClient.class,org.springframework.http.client.reactive.ClientHttpConnector.class,org.springframework.security.oauth2.client.registration.ClientRegistrationRepository.class}) @EnableConfigurationProperties({CommonExternalServiceConnectionPoolTemplateProperties.class,CommonExternalServiceDefaultConnectionPoolProperties.class}) public class CommonExternalServiceConnectionAutoConfiguration extends Object
Configuration for outbound, external third-party integration client connections.

Analogous to the configuration in CommonInternalServiceConnectionAutoConfiguration, but opinionated for external communication.

Since:
MicroExtensionCommon 3.0.0
See Also:
  • Constructor Details

    • CommonExternalServiceConnectionAutoConfiguration

      public CommonExternalServiceConnectionAutoConfiguration()
  • Method Details

    • commonExtlSvcClientConnectorFactory

      @Bean(name="commonExtlSvcClientConnectorFactory") @ConditionalOnMissingBean(name="commonExtlSvcClientConnectorFactory") public CommonExternalServiceClientConnectorFactory commonExtlSvcClientConnectorFactory(CommonExternalServiceConnectionPoolTemplateProperties poolProperties)
      Declares the default central factory bean that services can use to construct isolated, independent ClientHttpConnector and HttpClient instances for external communications.
      Parameters:
      poolProperties - the global connection pool tuning defaults
      Returns:
      the centralized factory bean for building external service client connection providers
    • commonExtlSvcClientConnector

      @Bean(name="commonExtlSvcClientConnector") @ConditionalOnMissingBean(name="commonExtlSvcClientConnector") public org.springframework.http.client.reactive.ClientHttpConnector commonExtlSvcClientConnector(@Qualifier("commonExtlSvcClientConnectorFactory") CommonExternalServiceClientConnectorFactory connectorFactory, CommonExternalServiceDefaultConnectionPoolProperties defaultConnectionPoolProperties)

      CommonExternalServiceClientConnectorFactory provides a starting template for external service integrations to define their own isolated connection pools. However, in many cases, integrations may not require a high degree of isolation and can simplify the overall configuration and resource footprint by sharing the same underlying connection pool. This bean is offered as the designated default ClientHttpConnector instance for this purpose.

      Note that by default, every HttpClient.create() in the JVM shares Reactor Netty's anonymous global HttpResources pool, which has metrics disabled.

      This bean, which leverages an explicitly named pool, makes the reactor.netty.connection.provider.* meters possible, allowing observation of outbound connection saturation for a given service.

      As a result, it is strongly recommended that any WebClient configurations that are currently leveraging the anonymous default pool switch to this as a backward compatible upgrade to centralized observability and configurability.

      Parameters:
      connectorFactory - the factory bean to build external connectors
      Returns:
      a default, fallback client HTTP connector