Interface DomainEventPublisher
- All Known Implementing Classes:
SimpleDomainEventPublisher
,ThreadLocalDomainEventPublisher
public interface DomainEventPublisher
A publisher of domain events. Subscribers can register with implementations of this interface
to be notified when events occur and are published.
- Author:
- RealLifeDeveloper
-
Method Summary
Modifier and TypeMethodDescriptionvoid
publish
(DomainEvent event) Publishes a domain event, i.e., notifies each registered subscriber about the event.void
subscribe
(DomainEventSubscriber<? extends DomainEvent> subscriber) Registers an event handler with this publisher.
-
Method Details
-
publish
Publishes a domain event, i.e., notifies each registered subscriber about the event.- Parameters:
event
- the event to publish
-
subscribe
Registers an event handler with this publisher.- Parameters:
subscriber
- the event handler to register- Throws:
IllegalArgumentException
- ifsubscriber
isnull
-