Exemplo n.º 1
0
        public async Task Activate(HandlerGraph handlers, CapabilityGraph capabilities, JasperRuntime runtime, OutgoingChannels channels)
        {
            var capabilityCompilation = capabilities.Compile(handlers, _serialization, channels, runtime, _transports, _lookups);

            var transports = _transports.Where(x => x.State == TransportState.Enabled).ToArray();

            if (!_settings.DisableAllTransports)
            {
                await _settings.ApplyLookups(_lookups);



                channels.StartTransports(_pipeline, _settings, transports);

                _delayedJobs.Start(_pipeline, channels);

                var local = new TransportNode(channels, _settings.MachineName);

                await _nodes.Register(local);
            }

            runtime.Capabilities = await capabilityCompilation;
            if (runtime.Capabilities.Errors.Any() && _settings.ThrowOnValidationErrors)
            {
                throw new InvalidSubscriptionException(runtime.Capabilities.Errors);
            }
        }
Exemplo n.º 2
0
        public async Task Activate(HandlerGraph handlers, CapabilityGraph capabilities, JasperRuntime runtime, ChannelGraph channels, LocalWorkerSender localWorker)
        {
            var capabilityCompilation = capabilities.Compile(handlers, _serialization, channels, runtime, _transports, _lookups);

            var transports = _transports.Where(x => _settings.StateFor(x.Protocol) != TransportState.Disabled)
                             .ToArray();

            _settings.Workers.Compile(handlers.Chains.Select(x => x.MessageType));

            localWorker.Start(_persistence, _workerQueue);

            if (!_settings.DisableAllTransports)
            {
                await _settings.ApplyLookups(_lookups);

                channels.Start(_settings, transports, _lookups, capabilities);


                _delayedJobs.Start(_workerQueue);
            }

            runtime.Capabilities = await capabilityCompilation;
            if (runtime.Capabilities.Errors.Any() && _settings.ThrowOnValidationErrors)
            {
                throw new InvalidSubscriptionException(runtime.Capabilities.Errors);
            }
        }
Exemplo n.º 3
0
        public async Task Activate(LocalWorkerSender localWorker, CapabilityGraph capabilities, JasperRuntime runtime,
                                   GenerationRules generation, PerfTimer timer)
        {
            timer.MarkStart("ServiceBusActivator");

            _handlers.Compile(generation, runtime, timer);


            var capabilityCompilation = capabilities.Compile(_handlers, Serialization, _channels, runtime, _transports, Lookup);



            var transports = _transports.Where(x => _settings.StateFor(x.Protocol) != TransportState.Disabled)
                             .ToArray();

            timer.Record("WorkersGraph.Compile", () =>
            {
                _settings.Workers.Compile(_handlers.Chains.Select(x => x.MessageType));
            });



            localWorker.Start(_persistence, Workers);

            if (!_settings.DisableAllTransports)
            {
                timer.MarkStart("ApplyLookups");

                await _settings.ApplyLookups(Lookup);

                timer.MarkFinished("ApplyLookups");


                timer.Record("ChannelGraph.Start",
                             () => { _channels.As <ChannelGraph>().Start(_settings, transports, Lookup, capabilities, Logger, Workers); });

                ScheduledJobs.Start(Workers);
            }

            runtime.Capabilities = await capabilityCompilation;
            if (runtime.Capabilities.Errors.Any() && _settings.ThrowOnValidationErrors)
            {
                throw new InvalidSubscriptionException(runtime.Capabilities.Errors);
            }

            timer.MarkFinished("ServiceBusActivator");
        }