public async Task Initialize(TimeSpan timeout) { if (!_eventStoreRepository.IStarted) { await _eventStoreRepository.Connect(timeout); } var group = _queueId.ToString(); await _eventStoreRepository.CreatePersistentSubscription(_providerName, group); _cleanUp = _eventStoreRepository.ObservePersistentSubscription(_providerName, group) .Subscribe(ev => { Debug.WriteLine($"{ev.StreamId} {ev.Version}"); //todo: implement batch _receivedMessages.Enqueue(new EventStoreBatchContainer(Guid.Empty, ev.StreamId, ev, new EventStoreStreamSequenceToken(ev.Version))); }); }