public void when_disposed_task()
        {
            var testEngineProcess = new TestEngineProcess();
            var host = new CqrsEngineHost(new[] { testEngineProcess, });

            host.Dispose();

            Assert.IsTrue(testEngineProcess.IsDisposed);
        }
Beispiel #2
0
        public override bool OnStart()
        {
            ServicePointManager.DefaultConnectionLimit = 48;
            RoleEnvironment.Changing += RoleEnvironmentChanging;

            _host = BuildBusWorker.Configure().Build();

            return base.OnStart();
        }
        public void when_start_task()
        {
            var testEngineProcess = new TestEngineProcess();
            var host = new CqrsEngineHost(new[] { testEngineProcess, });
            var task = host.Start(new CancellationToken());

            task.Wait();

            Assert.IsTrue(testEngineProcess.IsStarted);
        }
Beispiel #4
0
        public override bool OnStart()
        {
            ServicePointManager.DefaultConnectionLimit = 48;

            RoleEnvironment.Changing += RoleEnvironmentChanging;
            var cache = RoleEnvironment.GetLocalResource("LocalStorage");

            string connectionString;
            if (!AzureSettingsProvider.TryGetString(IdFor.StorageConnectionValueName, out connectionString))
                throw new InvalidOperationException("Storage connection string not found.");

            _host = BuildBusForWorker.Configure(cache.RootPath, connectionString).Build();

            return base.OnStart();
        }
Beispiel #5
0
        public Form1(CqrsEngineHost host, IObservable <ISystemEvent> observable)
        {
            _host       = host;
            _observable = observable;
            InitializeComponent();

            var sender  = _host.Resolve <IMessageSender>();
            var storage = _host.Resolve <NuclearStorage>();

            _viewport  = new LifelineViewport(_rich, _status);
            _processor = new InteractionProcessor(sender, _viewport, storage);

            _panel.BackColor  = Solarized.Base3;
            _rich.BackColor   = Solarized.Base3;
            _rich.ForeColor   = Solarized.Base00;
            _input.BackColor  = Solarized.Base03;
            _input.ForeColor  = Solarized.Base0;
            _status.BackColor = Solarized.Base03;
            _status.ForeColor = Solarized.Base01;
        }
Beispiel #6
0
        public Form1(CqrsEngineHost host, IObservable<ISystemEvent> observable)
        {
            _host = host;
            _observable = observable;
            InitializeComponent();

            var sender = _host.Resolve<IMessageSender>();
            var storage = _host.Resolve<NuclearStorage>();

            _viewport = new LifelineViewport(_rich, _status);
            _processor = new InteractionProcessor(sender, _viewport, storage);

            _panel.BackColor = Solarized.Base3;
            _rich.BackColor = Solarized.Base3;
            _rich.ForeColor = Solarized.Base00;
            _input.BackColor = Solarized.Base03;
            _input.ForeColor = Solarized.Base0;
            _status.BackColor = Solarized.Base03;
            _status.ForeColor = Solarized.Base01;
        }
Beispiel #7
0
        public void Start()
        {
            var config = FileStorage.CreateConfig(IntegrationPath, "files");

            var setup = new SetupClassThatReplacesIoCContainerFramework
            {
                CreateNuclear     = strategy => config.CreateNuclear(strategy),
                Streaming         = config.CreateStreaming(),
                Tapes             = config.CreateTape(Topology.TapesContainer),
                CreateInbox       = s => config.CreateInbox(s),
                CreateQueueWriter = s => config.CreateQueueWriter(s),
            };

            var components = setup.AssembleComponents();

            cts    = new CancellationTokenSource();
            engine = components.Builder.Build();
            task   = engine.Start(cts.Token);

            Bus.SetBus(new SimpleBus(components.Sender, components.Dispatcher));
            ProviderFactory.SetFactory(components.ProjectionFactory);
        }
        /// <summary>
        /// Builds this <see cref="CqrsEngineHost"/>.
        /// </summary>
        /// <returns>new instance of cloud engine host</returns>
        public CqrsEngineHost Build()
        {
            // nonconditional registrations
            // System presets
            _builder.RegisterType<DispatcherProcess>();
            _builder.RegisterInstance(new MemoryAccount());

            foreach (var module in _moduleEnlistments)
            {
                _builder.RegisterModule(module);
            }
            var container = _builder.Build();
            var system = new SystemObserver(_observers.ToArray());

            var reg = container.ComponentRegistry;

            Configure(reg, system);

            var processes = container.Resolve<IEnumerable<IEngineProcess>>();
            var scope = container.Resolve<ILifetimeScope>();
            var host = new CqrsEngineHost(scope, system, processes);
            host.Initialize();
            return host;
        }
        public void when_start_task_where_empty_task()
        {
            var host = new CqrsEngineHost(new IEngineProcess[] {});

            host.Start(new CancellationToken());
        }
Beispiel #10
0
 private static void SendFirstMessage(CqrsEngineHost host)
 {
     var sender = host.Resolve<IMessageSender>();
     var game = new Random().NextDouble().ToString();
     sender.SendOne(new PingPongCommand(0, game));
 }
 public override bool OnStart()
 {
     // this is actually azure initialization;
     _host = BuildHost();
     return base.OnStart();
 }