Class 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>
    A MessageConsumer that is calling a method of a class instance for every accepted Message

    MesageConsumer

    • 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
      void accept​(Message<T> message)  
      java.util.regex.Pattern keyPattern()
      Returns the pattern of Message.getKey() () message keys} accepted by this consumer.
      java.lang.Class<T> payloadType()
      Returns the expected payload type of messages consumed by this MessageConsumer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.function.Consumer

        andThen
    • Constructor Detail

      • MethodInvokingMessageConsumer

        public MethodInvokingMessageConsumer​(java.lang.String keyPattern,
                                             java.lang.Class<T> payloadType,
                                             java.lang.Object instance,
                                             java.lang.reflect.Method method)
    • Method Detail

      • payloadType

        @Nonnull
        public java.lang.Class<T> payloadType()
        Returns the expected payload type of messages consumed by this MessageConsumer.
        Specified by:
        payloadType in interface MessageConsumer<T>
        Returns:
        payload type
      • keyPattern

        @Nonnull
        public java.util.regex.Pattern keyPattern()
        Returns the pattern of Message.getKey() () message keys} accepted by this consumer.
        Specified by:
        keyPattern in interface MessageConsumer<T>
        Returns:
        Pattern
      • accept

        public void accept​(Message<T> message)
        Specified by:
        accept in interface java.util.function.Consumer<T>