Class DomainEventsPublisher
- Namespace
- Silverback.Domain
- Assembly
- Silverback.Core.Model.dll
Publishes the domain events stored into the domain entities.
public class DomainEventsPublisher
- Inheritance
-
DomainEventsPublisher
- Inherited Members
Constructors
DomainEventsPublisher(Func<IEnumerable<object>>, IPublisher)
Initializes a new instance of the DomainEventsPublisher class.
public DomainEventsPublisher(Func<IEnumerable<object>> entitiesProvider, IPublisher publisher)
Parameters
entitiesProviderFunc<IEnumerable<object>>The function returning the modified entities to be scanned for domain events.
publisherIPublisherThe IPublisher to be used to publish the events via the message bus.
DomainEventsPublisher(Func<IEnumerable<object>>, Func<object, IEnumerable<object>?>, Action<object>, IPublisher)
Initializes a new instance of the DomainEventsPublisher class.
public DomainEventsPublisher(Func<IEnumerable<object>> entitiesProvider, Func<object, IEnumerable<object>?> eventsSelector, Action<object> clearEventsAction, IPublisher publisher)
Parameters
entitiesProviderFunc<IEnumerable<object>>The function returning the modified entities to be scanned for domain events.
eventsSelectorFunc<object, IEnumerable<object>>The custom delegate to be used to get the events out of the entities being saved.
clearEventsActionAction<object>The custom delegate to be used to clear the events from the entities after they have been published.
publisherIPublisherThe IPublisher to be used to publish the events via the message bus.
Methods
PublishDomainEvents()
Publishes the domain events stored into the domain entities returned by the provider function.
public void PublishDomainEvents()
PublishDomainEventsAsync()
Publishes the domain events stored into the domain entities returned by the provider function.
public ValueTask PublishDomainEventsAsync()