Class Consume<T>

  • Type Parameters:
    T - the type of messages of the Channel
    All Implemented Interfaces:
    Action<T>

    public final class Consume<T>
    extends Object
    implements Action<T>
    The Consume Action calls the given consumer for every message that reached the end of the Channel.
    See Also:
    EventMaid Documentation
    • Constructor Detail

      • Consume

        public Consume()
    • Method Detail

      • consumeMessage

        public static <T> Consume<T> consumeMessage​(Consumer<ProcessingContext<T>> consumer)
        Factory method for creating a new Consume Action for a consumer accepting ProcessingContext.
        Type Parameters:
        T - the type of the Channels payload
        Parameters:
        consumer - consumer to be called for each message
        Returns:
        a new Consume Action
      • consumePayload

        public static <T> Consume<T> consumePayload​(Consumer<T> consumer)
        Factory method for creating a new Consume Action for a consumer accepting ProcessingContext.
        Type Parameters:
        T - the type of the Channels payload
        Parameters:
        consumer - consumer to be called for each message
        Returns:
        a new Consume Action
      • accept

        public void accept​(ProcessingContext<T> processingContext)
        Executes the consumer with the given message
        Parameters:
        processingContext - the message