public MessageBootstrapper(IMessageStore store, DisruptorFactory disruptors)
        {
            if (store == null)
            {
                throw new ArgumentNullException("store");
            }

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

            this.store      = store;
            this.disruptors = disruptors;

            var types = this.GetType().Assembly.GetTypes();

            for (var i = 0; i < types.Length; i++)
            {
                if (typeof(IInternalMessage).IsAssignableFrom(types[i]))
                {
                    this.internalTypes.Add(types[i].ResolvableTypeName());
                }
            }
        }
示例#2
0
        public SnapshotBootstrapper(SnapshotFactory snapshotFactory, DisruptorFactory disruptorFactory, long snapshotFrequency)
        {
            if (snapshotFactory == null)
            {
                throw new ArgumentNullException("snapshotFactory");
            }

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

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

            this.snapshotFactory   = snapshotFactory;
            this.disruptorFactory  = disruptorFactory;
            this.snapshotFrequency = snapshotFrequency;
        }
示例#3
0
        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;
        }
示例#4
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);
        }