Table of Contents

Class EventPublisherExtensions

Namespace
Silverback.Messaging.Publishing
Assembly
Silverback.Core.Model.dll
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

publisher IPublisher

The IPublisher.

eventMessage IEvent

The event to be published.

throwIfUnhandled bool

A 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

publisher IPublisher

The IPublisher.

eventMessage IEvent

The event to be published.

throwIfUnhandled bool

A boolean value indicating whether an exception must be thrown if no subscriber is handling the message.

cancellationToken CancellationToken

The CancellationToken that can be used to cancel the operation.

Returns

Task

A Task representing the asynchronous operation.

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

publisher IPublisher

The IPublisher.

eventMessage IEvent

The event to be published.

cancellationToken CancellationToken

The CancellationToken that can be used to cancel the operation.

Returns

Task

A Task representing the asynchronous operation.