コード例 #1
0
 public CollectionWrapper(
     IMongoStorageFactory factory,
     INotifyToSubscribers notifyToSubscribers
     )
 {
     _notifyToSubscribers = notifyToSubscribers;
     _storage             = factory.GetCollection <TModel, TKey>();
 }
コード例 #2
0
 public CollectionWrapper(
     IMongoStorageFactory factory,
     INotifyToSubscribers notifyToSubscribers
     )
 {
     _notifyToSubscribers           = notifyToSubscribers;
     _storage                       = factory.GetCollection <TModel, TKey>();
     _pollableSecondaryIndexCounter = DateTime.UtcNow.Ticks;
 }
コード例 #3
0
        public virtual void TestFixtureSetUp()
        {
            _eventStoreConnectionString = ConfigurationManager.ConnectionStrings["eventstore"].ConnectionString;

            var url    = new MongoUrl(_eventStoreConnectionString);
            var client = new MongoClient(url);

            _db = client.GetDatabase(url.DatabaseName);
            _db.Drop();

            ProjectionEngineConfig config = new ProjectionEngineConfig();

            config.EventStoreConnectionString = _eventStoreConnectionString;
            config.Slots      = new string[] { "*" };
            config.TenantId   = new TenantId("A");
            config.BucketInfo = new List <BucketInfo>();
            config.BucketInfo.Add(new BucketInfo()
            {
                Slots = new[] { "*" }, BufferSize = 10000
            });

            _identityConverter = new IdentityManager(new CounterService(_db));
            _identityConverter.RegisterIdentitiesFromAssembly(typeof(SampleAggregateId).Assembly);
            ConfigureEventStore();
            CommitEnhancer commitEnhancer = new CommitEnhancer(_identityConverter);

            _eventUnwinder = new EventUnwinder(config, new TestLogger(LoggerLevel.Info));

            _unwindedEventCollection = _db.GetCollection <UnwindedDomainEvent>("UnwindedEvents");
            MongoFlatMapper.EnableFlatMapping(true);
            MongoFlatIdSerializerHelper.Initialize(_identityConverter);

            var rebuildContext = new RebuildContext(NitroEnabled);

            _storageFactory = new MongoStorageFactory(_db, rebuildContext);

            _reader1 = new MongoReader <SampleReadModel, string>(_db);
            _reader2 = new MongoReader <SampleReadModel2, string>(_db);
            _reader3 = new MongoReader <SampleReadModel3, string>(_db);

            //now configure RebuildProjectionEngine
            _tracker = new ConcurrentCheckpointTracker(_db);


            var projections = BuildProjections().ToArray();

            _tracker.SetUp(projections, 1, false);
            ProjectionEventInspector inspector = new ProjectionEventInspector();

            inspector.AddAssembly(Assembly.GetExecutingAssembly());
            sut        = new RebuildProjectionEngine(_eventUnwinder, _tracker, projections, rebuildContext, config, inspector);
            sut.Logger = new TestLogger(LoggerLevel.Debug);

            _checkpointCollection = _db.GetCollection <Checkpoint>("checkpoints");
        }
コード例 #4
0
 public MongoReaderForProjections(IMongoStorageFactory factory)
 {
     _storage = factory.GetCollection <TModel, TKey>();
 }