Class ReadModelWatcher<TReadModel>
- Namespace
- Cratis.Chronicle.ReadModels
- Assembly
- Cratis.Chronicle.dll
Represents an implementation of IReadModelWatcher<TReadModel>.
public class ReadModelWatcher<TReadModel> : IReadModelWatcher<TReadModel>, IReadModelWatcher, IDisposable
Type Parameters
TReadModelType of read model the watcher is for.
- Inheritance
-
ReadModelWatcher<TReadModel>
- Implements
-
IReadModelWatcher<TReadModel>
- Inherited Members
- Extension Methods
Constructors
ReadModelWatcher(IEventStore, Action, JsonSerializerOptions)
Initializes a new instance of the ReadModelWatcher<TReadModel> class.
public ReadModelWatcher(IEventStore eventStore, Action stopped, JsonSerializerOptions jsonSerializerOptions)
Parameters
eventStoreIEventStoreIEventStore the watcher is for.
stoppedActionCallback for when the watcher is stopped.
jsonSerializerOptionsJsonSerializerOptionsOptions for JSON serialization.
Properties
Observable
Gets the observable for the read model.
public IObservable<ReadModelChangeset<TReadModel>> Observable { get; }
Property Value
- IObservable<ReadModelChangeset<TReadModel>>
Subscribed
Gets a Task that completes once the watcher's underlying change-stream subscription on the server has been established. Awaiting this guarantees that any events appended afterwards will be observed through Observable.
public Task Subscribed { get; }
Property Value
Methods
Dispose()
public void Dispose()
Start()
Start the watcher.
public void Start()
Stop()
Stop the watcher. Will be removed from the manager.
public void Stop()