Class EventPublisherExtensions
- Namespace
- Silverback.Messaging.Publishing
- Assembly
- Silverback.Core.Model.dll
Adds the PublishEvent(IPublisher, IEvent, bool) and PublishEventAsync(IPublisher, IEvent, CancellationToken) methods to the IPublisher interface.
public static class EventPublisherExtensions
- Inheritance
-
EventPublisherExtensions
- Inherited Members
Methods
PublishEvent(IPublisher, IEvent, bool)
Publishes the specified event to its subscribers via the message bus and the method will not complete until all subscribers have processed it (unless using Silverback.Integration to produce and consume the message through a message broker).
public static void PublishEvent(this IPublisher publisher, IEvent eventMessage, bool throwIfUnhandled = false)
Parameters
publisherIPublisherThe IPublisher.
eventMessageIEventThe event to be published.
throwIfUnhandledboolA boolean value indicating whether an exception must be thrown if no subscriber is handling the message.
PublishEventAsync(IPublisher, IEvent, bool, CancellationToken)
Publishes the specified event to its subscribers via the message bus and the Task will not complete until all subscribers have processed it (unless using Silverback.Integration to produce and consume the message through a message broker).
public static Task PublishEventAsync(this IPublisher publisher, IEvent eventMessage, bool throwIfUnhandled, CancellationToken cancellationToken = default)
Parameters
publisherIPublisherThe IPublisher.
eventMessageIEventThe event to be published.
throwIfUnhandledboolA boolean value indicating whether an exception must be thrown if no subscriber is handling the message.
cancellationTokenCancellationTokenThe CancellationToken that can be used to cancel the operation.
Returns
PublishEventAsync(IPublisher, IEvent, CancellationToken)
Publishes the specified event to its subscribers via the message bus and the Task will not complete until all subscribers have processed it (unless using Silverback.Integration to produce and consume the message through a message broker).
public static Task PublishEventAsync(this IPublisher publisher, IEvent eventMessage, CancellationToken cancellationToken = default)
Parameters
publisherIPublisherThe IPublisher.
eventMessageIEventThe event to be published.
cancellationTokenCancellationTokenThe CancellationToken that can be used to cancel the operation.