Class NonBlockingRetryEnvironmentPostProcessor

java.lang.Object
com.broadleafcommerce.common.messaging.retry.nonblocking.NonBlockingRetryEnvironmentPostProcessor
All Implemented Interfaces:
org.springframework.boot.env.EnvironmentPostProcessor

public class NonBlockingRetryEnvironmentPostProcessor extends Object implements org.springframework.boot.env.EnvironmentPostProcessor
Setup environment based on NonBlockingRetryProperties
  • Constructor Details

    • NonBlockingRetryEnvironmentPostProcessor

      public NonBlockingRetryEnvironmentPostProcessor()
  • Method Details

    • postProcessEnvironment

      public void postProcessEnvironment(org.springframework.core.env.ConfigurableEnvironment environment, org.springframework.boot.SpringApplication application)
      Specified by:
      postProcessEnvironment in interface org.springframework.boot.env.EnvironmentPostProcessor
    • setupAckDeadline

      protected void setupAckDeadline(NonBlockingRetryProperties nonBlockingRetryProperties, org.springframework.core.env.ConfigurableEnvironment environment, Map<String,Object> propertySource)
      Set up the spring.cloud.gcp.pubsub.subscriber.max-ack-extension-period property based on NonBlockingRetryProperties.PubSub.getMaxAckExtensionPeriod() value, if not already defined. Only relevant to pubsub bindings - harmless otherwise.
      Parameters:
      nonBlockingRetryProperties - The non-blocking retry configuration
      environment - The spring environment
      propertySource - The property source that will be contributed to the spring environment
    • validateRetryInfo

      protected void validateRetryInfo(NonBlockingFixedRetryInfo retryInfo, List<String> usedNames)
      Validate the non-blocking retry configuration
      Parameters:
      retryInfo - The specific retry configuration
      usedNames - retry consumer and producer bindings (from retryInfo) that have already been used
    • setupRetryBindingIfApplicable

      protected void setupRetryBindingIfApplicable(String originalConsumerBinding, NonBlockingFixedRetryInfo retryInfo, org.springframework.core.env.ConfigurableEnvironment environment, Map<String,Object> propertySource)
      Set up the spring cloud stream retry binding consumer, producer, and DLQ properties, if they don't already exist.
      Parameters:
      originalConsumerBinding - The simple name of the original consumer binding
      retryInfo - The specific non-blocking retry configuration
      environment - The Spring environment
      propertySource - The property source used to inform the Spring environment
    • setupRetryProducer

      protected void setupRetryProducer(NonBlockingFixedRetryInfo retryInfo, org.springframework.core.env.ConfigurableEnvironment environment, Map<String,Object> propertySource)
      Set up the spring cloud stream retry producer binding property, if it does not already exist.
      Parameters:
      retryInfo - The specific non-blocking retry configuration
      environment - The Spring environment
      propertySource - The property source used to inform the Spring environment
      See Also:
    • setupDlq

      protected void setupDlq(String dlq, org.springframework.core.env.ConfigurableEnvironment environment, Map<String,Object> propertySource)
      Set up the spring cloud stream DLQ producer binding property, if it does not already exist.
      Parameters:
      dlq - The simple root name of the DLQ
      environment - The Spring environment
      propertySource - The property source used to inform the Spring environment
      See Also:
    • setupRetryConsumer

      protected void setupRetryConsumer(String originalConsumerBinding, NonBlockingFixedRetryInfo retryInfo, org.springframework.core.env.ConfigurableEnvironment environment, Map<String,Object> propertySource)
      Set up the spring cloud stream retry consumer binding property, if it does not already exist.
      Parameters:
      originalConsumerBinding - The simple name of the original consumer binding
      retryInfo - The specific non-blocking retry configuration
      environment - The Spring environment
      propertySource - The property source used to inform the Spring environment
      See Also:
    • setupKafkaConsumer

      protected void setupKafkaConsumer(NonBlockingFixedRetryInfo retryInfo, org.springframework.core.env.ConfigurableEnvironment environment, Map<String,Object> propertySource)
      Set up spring cloud stream properties related to retry consumption for kafka for the non-blocking case. Notable here is establishing the ack-mode as MANUAL.
      Parameters:
      retryInfo - The specific non-blocking retry configuration
      environment - The Spring environment
      propertySource - The property source used to inform the Spring environment
    • setupPubSubConsumer

      protected void setupPubSubConsumer(NonBlockingFixedRetryInfo retryInfo, org.springframework.core.env.ConfigurableEnvironment environment, Map<String,Object> propertySource)
      Set up spring cloud stream properties related to retry consumption for pubsub for the non-blocking case. Notable here is establishing the ack-mode as MANUAL.
      Parameters:
      retryInfo - The specific non-blocking retry configuration
      environment - The Spring environment
      propertySource - The property source used to inform the Spring environment
    • determineBinderType

      protected String determineBinderType(String fullyQualifiedOriginalConsumerBinding, org.springframework.core.env.ConfigurableEnvironment environment)
      Determine the implementation type of the binder associated with a consumer binding
      Parameters:
      fullyQualifiedOriginalConsumerBinding - The fully qualified property name of the original consumer binding
      environment - The spring environment
      Returns:
      The binder type