org.qi4j.library.eventsourcing.domain.source.helper
Class EventRouter
java.lang.Object
org.qi4j.library.eventsourcing.domain.source.helper.EventRouter
- All Implemented Interfaces:
- EventVisitor
public class EventRouter
- extends Object
- implements EventVisitor
Event handling router. Add specification->visitor routes. When an event comes in
the router will ask each specification if it matches, and if so, delegate to the
visitor and return whether it successfully handled it or not. If no routes match,
returns true.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EventRouter
public EventRouter()
route
public EventRouter route(Specification<DomainEventValue> specification,
EventVisitor visitor)
visit
public boolean visit(DomainEventValue eventValue)
- Route an eventValue to a visitor whose specification matches it. If no
specification matches, then return true. Otherwise return the status
of the visitor that was matched.
- Specified by:
visit
in interface EventVisitor
- Parameters:
eventValue
- the eventValue
- Returns:
- true if eventValue was handled successfully.