library
library copied to clipboard
Create concept of PublishedEvent
So currently the all of the domain events have information about business facts.
If we want to publish them we need to add metadata like:
causationID, corellationID, uniqueMessageID etc
so PublishedEvent becomes DomainEvent + metadata
So, if I understand correctly, do you mean that
public interface EventsStorage {
void save(DomainEvent event);
List<DomainEvent> toPublish();
void published(List<DomainEvent> events);
}
should be more like
public interface EventsStorage {
void save(DomainEvent event);
List<DomainEvent> toPublish();
void published(List<PublishedEvent> events);
}
I mean that PublishedEvent should keep DomainEvent inside :)