public ProximityService(EventStoreCache <Guid, PositionRecord, PositionRecordsDto> cache, ILoggerFactory loggerFactory)
 {
     _cache       = cache;
     _logger      = loggerFactory.CreateLogger <ProximityService>();
     _proximities = new List <ProximityEvent>();
 }
        public EventStoreStatefulActorBuilder <TActor, TAggregate, TRegistry> WithReadManyStreamsFromStartCache(
            string[] streamIds,
            IEventTypeProvider <TAggregate> eventTypeProvider,
            Action <MultipleStreamsCatchupCacheConfiguration <TAggregate> > getMultipleStreamsCatchupCacheConfiguration = null,
            ISnapshotStore <TAggregate> snapshotStore = null,
            ISnapshotStrategy snapshotStrategy        = null)
        {
            if (null != EventStoreCache)
            {
                throw new InvalidOperationException($"A cache has already been set => {EventStoreCache.GetType()}");
            }

            var multipleStreamsCatchupCacheConfiguration = new MultipleStreamsCatchupCacheConfiguration <TAggregate>(streamIds);

            getMultipleStreamsCatchupCacheConfiguration?.Invoke(multipleStreamsCatchupCacheConfiguration);

            EventStoreCache = new MultipleStreamsCatchupCache <TAggregate>(ConnectionMonitor, multipleStreamsCatchupCacheConfiguration, eventTypeProvider, LoggerFactory, snapshotStore, snapshotStrategy);

            return(this);
        }
        public EventStoreStatefulActorBuilder <TActor, TAggregate, TRegistry> WithReadAllFromEndCache(
            IEventTypeProvider <TAggregate> eventTypeProvider,
            Action <AllStreamsCatchupCacheConfiguration <TAggregate> > getSubscribeFromEndCacheConfiguration = null)
        {
            if (null != EventStoreCache)
            {
                throw new InvalidOperationException($"A cache has already been set => {EventStoreCache.GetType()}");
            }

            var subscribeFromEndCacheConfiguration = new AllStreamsCatchupCacheConfiguration <TAggregate>(Position.End);

            getSubscribeFromEndCacheConfiguration?.Invoke(subscribeFromEndCacheConfiguration);

            EventStoreCache = new AllStreamsCatchupCache <TAggregate>(ConnectionMonitor, subscribeFromEndCacheConfiguration, eventTypeProvider, LoggerFactory);

            return(this);
        }
        public EventStoreStatefulActorBuilder <TActor, TAggregate, TRegistry> WithReadAllFromStartCache(
            IEventTypeProvider <TAggregate> eventTypeProvider,
            Action <AllStreamsCatchupCacheConfiguration <TAggregate> > getCatchupEventStoreCacheConfigurationBuilder = null,
            ISnapshotStore <TAggregate> snapshotStore = null,
            ISnapshotStrategy snapshotStrategy        = null)
        {
            if (null != EventStoreCache)
            {
                throw new InvalidOperationException($"A cache has already been set => {EventStoreCache.GetType()}");
            }

            var catchupEventStoreCacheConfiguration = new AllStreamsCatchupCacheConfiguration <TAggregate>(Position.Start);

            getCatchupEventStoreCacheConfigurationBuilder?.Invoke(catchupEventStoreCacheConfiguration);

            EventStoreCache = new AllStreamsCatchupCache <TAggregate>(ConnectionMonitor, catchupEventStoreCacheConfiguration, eventTypeProvider, LoggerFactory, snapshotStore, snapshotStrategy);

            return(this);
        }