Interface IdempotentMessageConsumptionService

All Known Implementing Classes:
DefaultIdempotentMessageConsumptionService

public interface IdempotentMessageConsumptionService
Service responsible for enforcing idempotency checks on a message before executing an operation against the message.
Author:
Chris Kittrell (ckittrell)
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> void
    consumeMessage(org.springframework.messaging.Message<T> message, String listenerName, Consumer<org.springframework.messaging.Message<T>> operation)
    Executes the provided operation if the message's idempotency check passes.
    <T, R> R
    consumeMessage(org.springframework.messaging.Message<T> message, String listenerName, Function<org.springframework.messaging.Message<T>,R> operation)
    Executes the provided operation if the message's idempotency check passes.
  • Method Details

    • consumeMessage

      <T> void consumeMessage(org.springframework.messaging.Message<T> message, String listenerName, Consumer<org.springframework.messaging.Message<T>> operation)
      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.
      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
      Throws:
      Exception - if an unexpected exception is encountered while executing the operation
    • consumeMessage

      @Nullable <T, R> R consumeMessage(org.springframework.messaging.Message<T> message, String listenerName, Function<org.springframework.messaging.Message<T>,R> operation)
      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.
      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
      Throws:
      Exception - if an unexpected exception is encountered while executing the operation