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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringdetermineBinderType(String fullyQualifiedOriginalConsumerBinding, org.springframework.core.env.ConfigurableEnvironment environment) Determine the implementation type of the binder associated with a consumer bindingvoidpostProcessEnvironment(org.springframework.core.env.ConfigurableEnvironment environment, org.springframework.boot.SpringApplication application) protected voidsetupAckDeadline(NonBlockingRetryProperties nonBlockingRetryProperties, org.springframework.core.env.ConfigurableEnvironment environment, Map<String, Object> propertySource) Set up thespring.cloud.gcp.pubsub.subscriber.max-ack-extension-periodproperty based onNonBlockingRetryProperties.PubSub.getMaxAckExtensionPeriod()value, if not already defined.protected voidsetupDlq(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.protected voidsetupKafkaConsumer(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.protected voidsetupPubSubConsumer(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.protected voidsetupRetryBindingIfApplicable(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.protected voidsetupRetryConsumer(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.protected voidsetupRetryProducer(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.protected voidvalidateRetryInfo(NonBlockingFixedRetryInfo retryInfo, List<String> usedNames) Validate the non-blocking retry configuration
-
Constructor Details
-
NonBlockingRetryEnvironmentPostProcessor
public NonBlockingRetryEnvironmentPostProcessor()
-
-
Method Details
-
postProcessEnvironment
public void postProcessEnvironment(org.springframework.core.env.ConfigurableEnvironment environment, org.springframework.boot.SpringApplication application) - Specified by:
postProcessEnvironmentin interfaceorg.springframework.boot.env.EnvironmentPostProcessor
-
setupAckDeadline
protected void setupAckDeadline(NonBlockingRetryProperties nonBlockingRetryProperties, org.springframework.core.env.ConfigurableEnvironment environment, Map<String, Object> propertySource) Set up thespring.cloud.gcp.pubsub.subscriber.max-ack-extension-periodproperty based onNonBlockingRetryProperties.PubSub.getMaxAckExtensionPeriod()value, if not already defined. Only relevant to pubsub bindings - harmless otherwise.- Parameters:
nonBlockingRetryProperties- The non-blocking retry configurationenvironment- The spring environmentpropertySource- The property source that will be contributed to the spring environment
-
validateRetryInfo
Validate the non-blocking retry configuration- Parameters:
retryInfo- The specific retry configurationusedNames- 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 bindingretryInfo- The specific non-blocking retry configurationenvironment- The Spring environmentpropertySource- 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 configurationenvironment- The Spring environmentpropertySource- 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 DLQenvironment- The Spring environmentpropertySource- 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 bindingretryInfo- The specific non-blocking retry configurationenvironment- The Spring environmentpropertySource- 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 configurationenvironment- The Spring environmentpropertySource- 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 configurationenvironment- The Spring environmentpropertySource- 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 bindingenvironment- The spring environment- Returns:
- The binder type
-