コード例 #1
0
ファイル: Bootstrapper.cs プロジェクト: carwilki/hydrospanner
        internal Bootstrapper(
            IRepository repository,
            DisruptorFactory disruptors,
            SnapshotBootstrapper snapshots,
            MessageBootstrapper messages,
            TimeoutFactory timeout,
            MessagingFactory messaging)
        {
            if (repository == null)
            {
                throw new ArgumentNullException("repository");
            }
            if (disruptors == null)
            {
                throw new ArgumentNullException("disruptors");
            }
            if (snapshots == null)
            {
                throw new ArgumentNullException("snapshots");
            }
            if (messages == null)
            {
                throw new ArgumentNullException("messages");
            }
            if (timeout == null)
            {
                throw new ArgumentNullException("timeout");
            }
            if (messaging == null)
            {
                throw new ArgumentNullException("messaging");
            }

            this.repository = repository;
            this.disruptors = disruptors;
            this.snapshots  = snapshots;
            this.messages   = messages;
            this.timeout    = timeout;
            this.messaging  = messaging;
        }
コード例 #2
0
ファイル: Wireup.cs プロジェクト: carwilki/hydrospanner
        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);
        }