Class DefaultIdempotentMessageConsumptionService

java.lang.Object
com.broadleafcommerce.common.messaging.service.DefaultIdempotentMessageConsumptionService
All Implemented Interfaces:
IdempotentMessageConsumptionService

public class DefaultIdempotentMessageConsumptionService extends Object implements IdempotentMessageConsumptionService
Service responsible for enforcing idempotency checks on a message before executing an operation against the message.
Author:
Chris Kittrell (ckittrell)
  • Field Details

  • Constructor Details

    • DefaultIdempotentMessageConsumptionService

      public DefaultIdempotentMessageConsumptionService(MessageLockService messageLockService)
  • Method Details

    • consumeMessage

      public <T> void consumeMessage(org.springframework.messaging.Message<T> message, String listenerName, Consumer<org.springframework.messaging.Message<T>> operation)
      Description copied from interface: IdempotentMessageConsumptionService
      Executes the provided operation if the message's idempotency check passes. If the message fails the idempotency check, then we'll quietly return to the caller without executing the operation.
      Specified by:
      consumeMessage in interface IdempotentMessageConsumptionService
      Parameters:
      message - The message that is to be processed.
      listenerName - The name of the message listener. This value can be used to distinguish this message consumption from that of a different message listener.
      operation - The operation that is to be executed, without a return value
    • consumeMessage

      @Nullable public <T, R> R consumeMessage(org.springframework.messaging.Message<T> message, String listenerName, Function<org.springframework.messaging.Message<T>,R> operation)
      Description copied from interface: IdempotentMessageConsumptionService
      Executes the provided operation if the message's idempotency check passes. If the message fails the idempotency check, then we'll return null to the caller without executing the operation.
      Specified by:
      consumeMessage in interface IdempotentMessageConsumptionService
      Parameters:
      message - The message that is to be processed.
      listenerName - The name of the message listener. This value can be used to distinguish this message consumption from that of a different message listener.
      operation - The operation that is to be executed, with a return value
      Returns:
      The result of the operation
    • getMessageLockService

      protected MessageLockService getMessageLockService()