Package de.otto.synapse.consumer
Class MethodInvokingMessageConsumer<T>
java.lang.Object
de.otto.synapse.consumer.MethodInvokingMessageConsumer<T>
- Type Parameters:
T- The expected type of the message's payload
- All Implemented Interfaces:
MessageConsumer<T>,java.util.function.Consumer<Message<T>>
public class MethodInvokingMessageConsumer<T> extends java.lang.Object implements MessageConsumer<T>
-
Constructor Summary
Constructors Constructor Description MethodInvokingMessageConsumer(java.lang.String keyPattern, java.lang.Class<T> payloadType, java.lang.Object instance, java.lang.reflect.Method method) -
Method Summary
Modifier and Type Method Description voidaccept(Message<T> message)java.util.regex.PatternkeyPattern()Returns the pattern ofMessage.getKey()() message keys} accepted by this consumer.java.lang.Class<T>payloadType()Returns the expected payload type ofmessagesconsumed by this MessageConsumer.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.function.Consumer
andThen
-
Constructor Details
-
MethodInvokingMessageConsumer
public MethodInvokingMessageConsumer(java.lang.String keyPattern, java.lang.Class<T> payloadType, java.lang.Object instance, java.lang.reflect.Method method)
-
-
Method Details
-
payloadType
Returns the expected payload type ofmessagesconsumed by this MessageConsumer.- Specified by:
payloadTypein interfaceMessageConsumer<T>- Returns:
- payload type
-
keyPattern
@Nonnull public java.util.regex.Pattern keyPattern()Returns the pattern ofMessage.getKey()() message keys} accepted by this consumer.- Specified by:
keyPatternin interfaceMessageConsumer<T>- Returns:
- Pattern
-
accept
- Specified by:
acceptin interfacejava.util.function.Consumer<T>
-