Class MessageDispatcher

  • All Implemented Interfaces:
    java.util.function.Consumer<TextMessage>

    public class MessageDispatcher
    extends java.lang.Object
    implements java.util.function.Consumer<TextMessage>
    A MessageConsumer that is acting as a Message Dispatcher for multiple message consumers.

    MessageDispatcher

    As it is implementing the MessageConsumer interface, the MessageDispatcher is an implementation of the GoF Composite Pattern.

    Messages are translated by the dispatcher using to the format expected by the registered consumers.

    See Also:
    EIP: Message Dispatcher, Composite Pattern
    • Constructor Detail

      • MessageDispatcher

        public MessageDispatcher()
      • MessageDispatcher

        public MessageDispatcher​(java.util.List<MessageConsumer<?>> messageConsumers)
    • Method Detail

      • payloadType

        @Nonnull
        public java.lang.Class<java.lang.String> payloadType()
        Returns the expected payload type of events consumed by this EventConsumer.
        Returns:
        payload type
      • keyPattern

        @Nonnull
        public java.util.regex.Pattern keyPattern()
        Returns the pattern of event keys accepted by this consumer.
        Returns:
        Pattern