Table of Contents

Class HistoryEventPublisher<TEvent>

Namespace
LfrlAnvil.Reactive
Assembly
LfrlAnvil.Reactive.Core.dll

Represents a generic disposable event source that can be listened to, capable of recording previously published events.

public class HistoryEventPublisher<TEvent> : EventPublisher<TEvent>, IHistoryEventPublisher<TEvent>, IEventPublisher<TEvent>, IEventSource<TEvent>, IEventStream<TEvent>, IEventPublisher, IEventSource, IEventStream, IDisposable

Type Parameters

TEvent

Event type.

Inheritance
EventSource<TEvent>
HistoryEventPublisher<TEvent>
Implements
IEventSource<TEvent>
IEventStream<TEvent>
Inherited Members
Extension Methods

Constructors

HistoryEventPublisher(int)

Creates a new HistoryEventPublisher<TEvent> instance.

public HistoryEventPublisher(int capacity)

Parameters

capacity int

Specifies the maximum number of events this event publisher can record.

Exceptions

ArgumentOutOfRangeException

When capacity is less than 1.

Properties

Capacity

Specifies the maximum number of events this event publisher can record.

public int Capacity { get; }

Property Value

int

History

Collection of recorded previously published events.

public IReadOnlyCollection<TEvent> History { get; }

Property Value

IReadOnlyCollection<TEvent>

Methods

ClearHistory()

Removes all recorded events.

public void ClearHistory()

OnDispose()

Allows to provide custom disposal implementation.

protected override void OnDispose()

OnPublish(TEvent)

Allows to react to event publishing.

protected override void OnPublish(TEvent @event)

Parameters

event TEvent

Event to publish.

OnSubscriberAdded(IEventSubscriber, IEventListener<TEvent>)

Allows to react to attachment of a new event subscriber.

protected override void OnSubscriberAdded(IEventSubscriber subscriber, IEventListener<TEvent> listener)

Parameters

subscriber IEventSubscriber

Attached event subscriber.

listener IEventListener<TEvent>

Event listener attached to the event subscriber.