Broadleaf Microservices
  • v1.0.0-latest-prod

Customer Client Configuration

Customer Segment Resolution

These are properties related to resolving CustomerSegments.

Enabling

These properties should be configured in the containing service and are not enabled otherwise. They also do not have any property prefix defined to allow more granular control.

Example enablement
@Bean(name = "browseCustomerSegmentResolutionProperties")
@ConditionalOnMissingBean(name = "browseCustomerSegmentResolutionProperties")
@ConfigurationProperties("broadleaf.catalogbrowse.context.customer-segment-customizer")
public CustomerSegmentResolutionProperties browseCustomerSegmentResolutionProperties() {
    return new CustomerSegmentResolutionProperties();
}

Properties

  • request-attribute-list: Represents the list of attribute from a {@link WebRequest} to store on ResolveCustomerSegmentsRequest.

    • This is used to whitelist request attributes used when evaluating dynamic CustomerSegments.

    • The attribute name should be matched by a field name configured in metadata for the CustomerSegment#realtimeMatchRule rule-builder.

    • If the parameter has multiple values, then it will be added as an array to the request’s attributes map.

  • additional-claims: Represents a list of additional auth token claims to add as attributes to the ResolveCustomerSegmentsRequest for rules to be evaluated against.

    • The attribute name should be matched by a field name configured in metadata for the CustomerSegment#realtimeMatchRule rule-builder.

  • evaluating-rule-based-segments-externally-allowed: Whether to allow rule-based CustomerSegments with #internalEvaluationRequired set to true to be sent to the Customer Service to be evaluated.

    • This request an additional request to evaluate these segments outside the service using the Customer Client which can have a performance impact and be difficult to cache.

    • This is disabled by default.

Example Property Values
broadleaf:
  catalogbrowse:
    context:
      customer-segment-customizer:
        request-attribute-list:
          - geo-latitude
          - geo-longitude
        additional-claims:
          - custom_claim
    evaluating-rule-based-segments-externally-allowed: false

External Customer Segment Provider

These are properties for configuring the ExternalCustomerSegmentProvider.

Enabling

These properties should be configured in the containing service and are not enabled otherwise. They also do not have any property prefix defined.

Example enablement
@Configuration
public static class ExampleConfiguration {
    @Bean(name = "browseExternalSegmentProviderProperties")
    @ConditionalOnMissingBean(name = "browseExternalSegmentProviderProperties")
    @ConfigurationProperties("broadleaf.catalogbrowse.customer-segment-provider")
    public ExternalCustomerSegmentProviderProperties browseExternalSegmentProviderProperties() {
        return new ExternalCustomerSegmentProviderProperties();
    }
}

Properties

  • url: The base url for the customer service.

  • read-customer-segments-path: The path to read all rule-based customer segments.

    • This is typically used to read-all Dynamic segments using an RSQL filter: type==RULE_BASE;

  • resolve-customer-segments-path: The path to resolve customer segments according to the request details.

  • service-client: The service client to use when calling customer services.

Example Property Values
broadleaf:
  catalogbrowse:
    customer-segment-provider:
      url: https://localhost:8463/customer
      read-customer-segments-path: /segments
      resolve-customer-segments-path: /segment-resolver
      service-client: catalogbrowseclient

Caching

These are properties for configuring caching in components using the Customer Client.

Enabling

These properties can be enabled by importing CustomerClientCacheAutoConfiguration.class

Example enablement
@Configuration
@Import({CustomerClientCacheAutoConfiguration.class})
public static class ExampleConfiguration {}

Properties

  • broadleaf.customer.client.cache.dynamic-customer-segment-cache: Determines the time-to-live for the cache used to store the results of requests to read all dynamic customer segments used by CustomerSegmentContextInfoCustomizer.

    • Default is 5 minutes.

Example Property Values
broadleaf:
  customer:
    client:
      dynamic-customer-segment-cache: 5m