public PersistenceBootstrapper(PersistenceFactory factory)
        {
            if (factory == null)
            {
                throw new ArgumentNullException("factory");
            }

            this.factory = factory;
        }
Ejemplo n.º 2
0
        public DisruptorFactory(
            MessagingFactory messaging,
            PersistenceFactory persistence,
            SnapshotFactory snapshots,
            int snapshotFrequency,
            IDictionary <string, Type> aliasTypes,
            IEnumerable <Type> transientTypes)
        {
            if (messaging == null)
            {
                throw new ArgumentNullException("messaging");
            }

            if (persistence == null)
            {
                throw new ArgumentNullException("persistence");
            }

            if (snapshots == null)
            {
                throw new ArgumentNullException("snapshots");
            }

            if (snapshotFrequency <= 0)
            {
                throw new ArgumentOutOfRangeException("snapshotFrequency");
            }

            if (aliasTypes == null)
            {
                throw new ArgumentNullException("aliasTypes");
            }

            if (transientTypes == null)
            {
                throw new ArgumentNullException("transientTypes");
            }

            this.messaging         = messaging;
            this.snapshots         = snapshots;
            this.persistence       = persistence;
            this.snapshotFrequency = snapshotFrequency;
            this.aliasTypes        = aliasTypes;
            this.transientTypes    = new HashSet <Type>(transientTypes);
        }
Ejemplo n.º 3
0
        private Wireup(ConventionWireupParameters conventionWireup, IDictionary <string, Type> aliasTypes, IEnumerable <Type> transientTypes, IEnumerable <Assembly> assemblies)
        {
            Log.Info("Preparing to bootstrap the system.");
            var repository              = new DefaultRepository(new ConventionRoutingTable(assemblies));
            var persistenceFactory      = new PersistenceFactory(conventionWireup.JournalConnectionName, conventionWireup.DuplicateWindow, conventionWireup.JournalBatchSize);
            var snapshotFactory         = new SnapshotFactory(conventionWireup.SnapshotLocation, conventionWireup.PublicSnapshotConnectionName);
            var persistenceBootstrapper = new PersistenceBootstrapper(persistenceFactory);

            Log.Info("Connecting to message store.");
            this.info = persistenceBootstrapper.Restore();
            var duplicates       = new DuplicateStore(conventionWireup.DuplicateWindow, this.info.DuplicateIdentifiers);
            var timeoutFactory   = new TimeoutFactory();
            var messagingFactory = new MessagingFactory(conventionWireup.NodeId, conventionWireup.BrokerAddress, conventionWireup.SourceQueueName, duplicates);

            Log.Info("Loading bootstrap parameters.");
            var messageStore         = persistenceFactory.CreateMessageStore(this.info.SerializedTypes);
            var disruptorFactory     = new DisruptorFactory(messagingFactory, persistenceFactory, snapshotFactory, conventionWireup.SystemSnapshotFrequency, aliasTypes, transientTypes);
            var snapshotBootstrapper = new SnapshotBootstrapper(snapshotFactory, disruptorFactory, conventionWireup.SystemSnapshotFrequency);
            var messageBootstrapper  = new MessageBootstrapper(messageStore, disruptorFactory);

            this.bootstrapper = new Bootstrapper(repository, disruptorFactory, snapshotBootstrapper, messageBootstrapper, timeoutFactory, messagingFactory);
        }