protected override async Task ResetAsync() { var streamId = _streamId == null ? $"$ce-{_aggregateType.ToUpper()}" : _streamId.Id; using (var connection = _connectionProvider.GetConnection()) { await connection.ConnectAsync(); await connection.DeletePersistentSubscriptionAsync(streamId, _subscriptionName, await _connectionProvider.GetCredentials()); } }
public EventStoreStreamWriter( IEventStoreConnectionProvider connectionProvider, IEventSerializer eventSerializer) { _connectionProvider = connectionProvider; _eventSerializer = eventSerializer; _conn = _connectionProvider.GetConnection(); _conn.ConnectAsync().Wait(); }
private async Task Connect() { _connection = _connectionProvider.GetConnection(); await _connection.ConnectAsync(); Func <EventStoreCatchUpSubscription, ResolvedEvent, Task> processEvent = (subscriptionBase, resolvedEvent) => { return(HandleEvent(resolvedEvent)); }; Func <ESSubscription, ResolvedEvent, Task> processEventAlt = (subscriptionBase, resolvedEvent) => { return(HandleEvent(resolvedEvent)); }; var streamId = _streamId == null ? $"$ce-{_aggregateType.ToUpper()}" : _streamId.Id; if (_startPosition == StreamPosition.End) { _subscriptionBase = await _connection.SubscribeToStreamAsync( streamId, true, processEventAlt, subscriptionDropped : SubscriptionDropped); _connected = true; _status = SubscriptionConnectionStatus.Connected; } else { _catchUpSubscriptionBase = _connection.SubscribeToStreamFrom( streamId, 0, new CatchUpSubscriptionSettings( CatchUpSubscriptionSettings.Default.MaxLiveQueueSize, CatchUpSubscriptionSettings.Default.ReadBatchSize, false, true, CatchUpSubscriptionSettings.Default.SubscriptionName), processEvent, subscriptionDropped: SubscriptionDropped); _connected = true; _status = SubscriptionConnectionStatus.Connected; } }