Class NonBlockingRetryProperties

java.lang.Object
com.broadleafcommerce.common.messaging.retry.nonblocking.NonBlockingRetryProperties

@ConfigurationProperties("broadleaf.messaging.nonblocking.retry.cloud.stream") public class NonBlockingRetryProperties extends Object
Configuration for non-blocking retries for Spring Cloud Stream message processing. Spring does not offer a non-blocking option directly in Spring Cloud Stream, so this serves as a custom implementation. The approach is similar in design to that provided by org.springframework.kafka.annotation.RetryableTopic. However, rather than auto create bindings, this implementation simply allows pointing to an existing Spring Cloud Stream binding configurations for the required retries. This allows each binding to be freely configured in whatever way makes the most sense for the use case. This approach should work for any Spring Cloud Stream binder (not just Kafka).

Note - Consuming batches is not currently supported with this configuration.

  • Field Details

  • Constructor Details

    • NonBlockingRetryProperties

      public NonBlockingRetryProperties()
  • Method Details

    • isEnabled

      public boolean isEnabled()
      Whether the non-blocking retry feature is enabled
    • getBackOffCheckInterval

      public Duration getBackOffCheckInterval()
      The amount of time to wait between polling attempts when consuming the retry bindings defined in getBindings(). This can be a somewhat relaxed value and does not need to be as frequent as a normal message channel polling interval. Note, this is different (and generally shorter than) FixedRetryInfo.getBackOff(). Default is 15000 ms. Does not apply to all binder implementations. In the case of Kafka, this relates to org.springframework.kafka.support.Acknowledgment#nack(Duration) where the sleep duration will be the longest of either backOffCheckInterval, or maxPollInterval. The default maxPollInterval is 5 seconds.
    • getBindings

      public Map<String,List<NonBlockingFixedRetryInfo>> getBindings()
      The ordered list of retry configurations associated by the original consumer binding
      See Also:
    • getPubSub

    • setEnabled

      public void setEnabled(boolean enabled)
      Whether the non-blocking retry feature is enabled
    • setBackOffCheckInterval

      public void setBackOffCheckInterval(Duration backOffCheckInterval)
      The amount of time to wait between polling attempts when consuming the retry bindings defined in getBindings(). This can be a somewhat relaxed value and does not need to be as frequent as a normal message channel polling interval. Note, this is different (and generally shorter than) FixedRetryInfo.getBackOff(). Default is 15000 ms. Does not apply to all binder implementations. In the case of Kafka, this relates to org.springframework.kafka.support.Acknowledgment#nack(Duration) where the sleep duration will be the longest of either backOffCheckInterval, or maxPollInterval. The default maxPollInterval is 5 seconds.
    • setBindings

      public void setBindings(Map<String,List<NonBlockingFixedRetryInfo>> bindings)
      The ordered list of retry configurations associated by the original consumer binding
      See Also:
    • setPubSub

      public void setPubSub(NonBlockingRetryProperties.PubSub pubSub)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object