Class Consume<T>
- java.lang.Object
-
- de.quantummaid.eventmaid.channel.action.Consume<T>
-
- Type Parameters:
T- the type of messages of theChannel
- All Implemented Interfaces:
Action<T>
public final class Consume<T> extends Object implements Action<T>
TheConsumeActioncalls the given consumer for every message that reached the end of theChannel.- See Also:
- EventMaid Documentation
-
-
Constructor Summary
Constructors Constructor Description Consume()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(ProcessingContext<T> processingContext)Executes the consumer with the given messagestatic <T> Consume<T>consumeMessage(Consumer<ProcessingContext<T>> consumer)Factory method for creating a newConsumeActionfor a consumer acceptingProcessingContext.static <T> Consume<T>consumePayload(Consumer<T> consumer)Factory method for creating a newConsumeActionfor a consumer acceptingProcessingContext.
-
-
-
Method Detail
-
consumeMessage
public static <T> Consume<T> consumeMessage(Consumer<ProcessingContext<T>> consumer)
Factory method for creating a newConsumeActionfor a consumer acceptingProcessingContext.- Type Parameters:
T- the type of theChannelspayload- Parameters:
consumer- consumer to be called for each message- Returns:
- a new
ConsumeAction
-
consumePayload
public static <T> Consume<T> consumePayload(Consumer<T> consumer)
Factory method for creating a newConsumeActionfor a consumer acceptingProcessingContext.- Type Parameters:
T- the type of theChannelspayload- Parameters:
consumer- consumer to be called for each message- Returns:
- a new
ConsumeAction
-
accept
public void accept(ProcessingContext<T> processingContext)
Executes the consumer with the given message- Parameters:
processingContext- the message
-
-