Interface IEventBusPublisher
Represents an event that can be published and subscribed to in the event bus system.
public interface IEventBusPublisher
- Extension Methods
Methods
PublishAsync<TEvent>(TEvent, CancellationToken)
Publishes an event asynchronously to all subscribers of the specified event type.
ValueTask PublishAsync<TEvent>(TEvent evt, CancellationToken ct = default) where TEvent : IEvent
Parameters
evt
TEventThe event to publish.
ct
CancellationTokenThe cancellation token to observe while publishing the event.
Returns
- ValueTask
A task that represents the asynchronous operation.
Type Parameters
TEvent
The type of the event to publish.
PublishSafeAsync<TEvent>(TEvent, CancellationToken)
Publishes an event asynchronously to all subscribers of the specified event type, catching any exceptions.
ValueTask PublishSafeAsync<TEvent>(TEvent evt, CancellationToken ct = default) where TEvent : IEvent
Parameters
evt
TEventThe event to publish.
ct
CancellationTokenThe cancellation token to observe while publishing the event.
Returns
- ValueTask
A task that represents the asynchronous operation.
Type Parameters
TEvent
The type of the event to publish.
PublishSafe<TEvent>(TEvent, CancellationToken)
Publishes an event synchronously to all subscribers of the specified event type, catching any exceptions.
void PublishSafe<TEvent>(TEvent evt, CancellationToken ct = default) where TEvent : IEvent
Parameters
evt
TEventThe event to publish.
ct
CancellationTokenThe cancellation token to observe while publishing the event.
Type Parameters
TEvent
The type of the event to publish.
Publish<TEvent>(TEvent, CancellationToken)
Publishes an event synchronously to all subscribers of the specified event type.
void Publish<TEvent>(TEvent evt, CancellationToken ct = default) where TEvent : IEvent
Parameters
evt
TEventThe event to publish.
ct
CancellationTokenThe cancellation token to observe while publishing the event.
Type Parameters
TEvent
The type of the event to publish.