Class BackOffAwareRetryConsumer

java.lang.Object
com.broadleafcommerce.common.messaging.retry.BackOffAwareRetryConsumer
Direct Known Subclasses:
KafkaNonBlockingRetryConsumer, PubSubDelayedRetryConsumer

public abstract class BackOffAwareRetryConsumer extends Object
Support for all non-blocking retry consumer implementations (per-binder)
  • Constructor Summary

    Constructors
    Constructor
    Description
    BackOffAwareRetryConsumer(com.broadleafcommerce.common.extension.compatibility.support.messaging.TimeoutAwareStreamBridge streamBridge)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    isBackOffSatisfied(org.springframework.messaging.Message<?> message)
    Inspect the message and detect if the backoff period has expired via the Constants.Header.NEXT_ATTEMPT_TIMESTAMP_HEADER header.
    protected void
    resend(org.springframework.messaging.Message<?> message)
    Send the message to the original consumer binding for re-processing.
    protected <S> org.springframework.messaging.support.MessageBuilder<S>
    reset(org.springframework.messaging.support.MessageBuilder<S> builder, org.springframework.messaging.Message<?> message)
    Perform last minute adjustments before resending the message to the original consumer binding

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BackOffAwareRetryConsumer

      public BackOffAwareRetryConsumer(com.broadleafcommerce.common.extension.compatibility.support.messaging.TimeoutAwareStreamBridge streamBridge)
  • Method Details

    • isBackOffSatisfied

      protected boolean isBackOffSatisfied(org.springframework.messaging.Message<?> message)
      Inspect the message and detect if the backoff period has expired via the Constants.Header.NEXT_ATTEMPT_TIMESTAMP_HEADER header.
      Parameters:
      message - The message to inspect for backoff fulfillment
      Returns:
      Whether the backoff period has been satisfied
    • resend

      protected void resend(org.springframework.messaging.Message<?> message)
      Send the message to the original consumer binding for re-processing. Detect the identity of the consumer binding via the Constants.Header.ORIGINAL_PRODUCER_BINDING_HEADER header.
      Parameters:
      message - The message to resend
    • reset

      protected <S> org.springframework.messaging.support.MessageBuilder<S> reset(org.springframework.messaging.support.MessageBuilder<S> builder, org.springframework.messaging.Message<?> message)
      Perform last minute adjustments before resending the message to the original consumer binding
      Type Parameters:
      S - The type of message
      Parameters:
      builder - The message builder for the message to send
      message - The original message that serves as an information source
      Returns:
      The modified message builder