AlertSchemaPersistence
StockSharp.Alerts
Keeps the alert schemas a user set up across runs: brings back what was stored when the host starts, and writes them again whenever one is added or removed.
Implements: IDisposable, IAsyncDisposable
Methods
Dispose
public void Dispose()
alertSchemaPersistence.Dispose()
Stops following changes. A write already under way finishes by itself.
DisposeAsync
public ValueTask DisposeAsync()
result = alertSchemaPersistence.DisposeAsync()
Stops following changes and waits for the last of them to be written.
Returns: ValueTask
StartAsync
public static Task<AlertSchemaPersistence> StartAsync(IAlertProcessingService service, Func<SettingsStorage> load, Action<SettingsStorage> save, Action<Exception> reportFailure, CancellationToken cancellationToken)
result = AlertSchemaPersistence.StartAsync(service, load, save, reportFailure, cancellationToken)
Restores what was stored and starts keeping it up to date.
- service
- The engine whose schemas are kept.
- load
- Reads what was stored, or returns when nothing was.
- save
- Writes the schemas.
- reportFailure
- Told when stored schemas could not be read or written.
- cancellationToken
- CancellationToken
Returns: The running persistence, to be disposed when the host stops.