Class DefaultIdempotentMessageConsumptionService

    • Constructor Detail

      • DefaultIdempotentMessageConsumptionService

        public DefaultIdempotentMessageConsumptionService​(MessageLockService messageLockService)
    • Method Detail

      • 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