Class SimpleEventDispatcher

java.lang.Object
org.fuin.cqrs4j.SimpleEventDispatcher
All Implemented Interfaces:
EventDispatcher

public final class SimpleEventDispatcher extends Object implements EventDispatcher
Registry with all event handlers.
  • Constructor Details

    • SimpleEventDispatcher

      public SimpleEventDispatcher(@NotNull @NotNull EventHandler... eventHandlers)
      Constructor with array of event handlers.
      Parameters:
      eventHandlers - Event handlers.
    • SimpleEventDispatcher

      public SimpleEventDispatcher(@NotNull @NotNull List<EventHandler> eventHandlers)
      Constructor with list of event handlers.
      Parameters:
      eventHandlers - Event handlers.
  • Method Details

    • getAllTypes

      @NotNull public final @NotNull Set<org.fuin.ddd4j.ddd.EventType> getAllTypes()
      Description copied from interface: EventDispatcher
      Returns a set of all known types.
      Specified by:
      getAllTypes in interface EventDispatcher
      Returns:
      All known event types.
    • dispatchCommonEvents

      public final void dispatchCommonEvents(@NotNull @NotNull List<org.fuin.esc.api.CommonEvent> commonEvents)
      Description copied from interface: EventDispatcher
      Dispatch all common events to the appropriate event handler.
      Specified by:
      dispatchCommonEvents in interface EventDispatcher
      Parameters:
      commonEvents - Events to dispatch.
    • dispatchEvents

      public final void dispatchEvents(@NotNull @NotNull List<org.fuin.ddd4j.ddd.Event> events)
      Description copied from interface: EventDispatcher
      Dispatch all events to the appropriate event handler.
      Specified by:
      dispatchEvents in interface EventDispatcher
      Parameters:
      events - Events to dispatch.
    • dispatchEvent

      public final void dispatchEvent(@NotNull @NotNull org.fuin.ddd4j.ddd.Event event)
      Description copied from interface: EventDispatcher
      Dispatches the given event to the appropriate event handler. The event is ignored if no event handler can be found that is capable of handling it.
      Specified by:
      dispatchEvent in interface EventDispatcher
      Parameters:
      event - Event to dispatch.