Package com.opencqrs.framework.command
Interface CommandEventPublisher<I>
- Type Parameters:
I- the instance type as defined by theCommandHandler
- All Superinterfaces:
EventPublisher
- All Known Implementing Classes:
CommandEventCapturer
Extension to
EventPublisher providing additional operations for publishing events relative to the
Command.getSubject() being handled.
Implementations may defer event publication, typically to the end of a successful command execution, in order to publish all captured events atomically.
-
Method Summary
Modifier and TypeMethodDescriptiondefault <E> Ipublish(E event) Publishes an event to the subject specified byCommand.getSubject()and applies it to any assignableStateRebuildingHandlers participating in the command execution.<E> IPublishes an event and its meta-data to the subject specified byCommand.getSubject()and applies it to any assignableStateRebuildingHandlers participating in the command execution.default <E> IpublishRelative(String subjectSuffix, E event) Publishes an event to the subject specified byCommand.getSubject()appended with the specified suffix and applies it to any assignableStateRebuildingHandlers participating in the command execution.<E> IpublishRelative(String subjectSuffix, E event, Map<String, ?> metaData) Publishes an event and its meta-data to the subject specified byCommand.getSubject()appended with the specified suffix and applies it to any assignableStateRebuildingHandlers participating in the command execution.Methods inherited from interface com.opencqrs.framework.persistence.EventPublisher
publish, publish, publish
-
Method Details
-
publish
Publishes an event to the subject specified byCommand.getSubject()and applies it to any assignableStateRebuildingHandlers participating in the command execution. No meta-data, i.e. an empty map, is published with the event.- Type Parameters:
E- the event type- Parameters:
event- the event to be published- Returns:
- an updated or new instance with all events applied
-
publish
Publishes an event and its meta-data to the subject specified byCommand.getSubject()and applies it to any assignableStateRebuildingHandlers participating in the command execution.- Type Parameters:
E- the event type- Parameters:
event- the event to be publishedmetaData- the event meta-data to be published- Returns:
- an updated or new instance with all events applied
-
publishRelative
Publishes an event to the subject specified byCommand.getSubject()appended with the specified suffix and applies it to any assignableStateRebuildingHandlers participating in the command execution. No meta-data, i.e. an empty map, is published with the event.- Type Parameters:
E- the event type- Parameters:
subjectSuffix- the suffix to be appended to theCommand.getSubject()currently executed, must not start with/event- the event to be published- Returns:
- an updated or new instance with all events applied
-
publishRelative
Publishes an event and its meta-data to the subject specified byCommand.getSubject()appended with the specified suffix and applies it to any assignableStateRebuildingHandlers participating in the command execution.- Type Parameters:
E- the event type- Parameters:
subjectSuffix- the suffix to be appended to theCommand.getSubject()currently executed, must not start with/event- the event to be publishedmetaData- the event meta-data to be published- Returns:
- an updated or new instance with all events applied
-