public async Task <IEndpointInstance> Start()
        {
            await receiveComponent.ReceivePreStartupChecks().ConfigureAwait(false);

            await transportInfrastructure.Start().ConfigureAwait(false);

            // This is a hack to maintain the current order of transport infrastructure initialization
            sendComponent.ConfigureSendInfrastructureForBackwardsCompatibility();

            var pipelineCache     = pipelineComponent.BuildPipelineCache(builder);
            var messageOperations = sendComponent.CreateMessageOperations(builder, pipelineComponent);
            var rootContext       = new RootContext(builder, messageOperations, pipelineCache);
            var messageSession    = new MessageSession(rootContext);

            AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);

            await receiveComponent.PrepareToStart(builder, recoverabilityComponent, messageOperations, pipelineComponent, pipelineCache).ConfigureAwait(false);

            // This is a hack to maintain the current order of transport infrastructure initialization
            await sendComponent.InvokeSendPreStartupChecksForBackwardsCompatibility().ConfigureAwait(false);

            await featureComponent.Start(builder, messageSession).ConfigureAwait(false);

            var runningInstance = new RunningEndpointInstance(settings, hostingComponent, receiveComponent, featureComponent, messageSession, transportInfrastructure);

            await receiveComponent.Start().ConfigureAwait(false);

            return(runningInstance);
        }
Exemple #2
0
        public async Task <IEndpointInstance> Start()
        {
            await sendComponent.SendPreStartupChecks().ConfigureAwait(false);

            await receiveComponent.ReceivePreStartupChecks().ConfigureAwait(false);

            await transportInfrastructure.Start().ConfigureAwait(false);

            var pipelineCache     = pipelineComponent.BuildPipelineCache(builder);
            var messageOperations = sendComponent.CreateMessageOperations(builder, pipelineComponent);
            var rootContext       = new RootContext(builder, messageOperations, pipelineCache);
            var messageSession    = new MessageSession(rootContext);

#if NETSTANDARD
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
            }
#else
            AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
#endif
            await receiveComponent.PrepareToStart(builder, recoverabilityComponent, messageOperations, pipelineComponent, pipelineCache).ConfigureAwait(false);

            await featureComponent.Start(builder, messageSession).ConfigureAwait(false);

            var runningInstance = new RunningEndpointInstance(settings, hostingComponent, receiveComponent, featureComponent, messageSession, transportInfrastructure);

            await receiveComponent.Start().ConfigureAwait(false);

            return(runningInstance);
        }
        public async Task <IEndpointInstance> Start()
        {
            await pipelineComponent.Start(containerComponent.Builder).ConfigureAwait(false);

            var messageSession = new MessageSession(pipelineComponent.CreateRootContext(containerComponent.Builder));

            await transportComponent.Start().ConfigureAwait(false);

            AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);

            await receiveComponent.PrepareToStart(containerComponent, recoverabilityComponent).ConfigureAwait(false);

            await featureComponent.Start(messageSession).ConfigureAwait(false);

            var runningInstance = new RunningEndpointInstance(settings, containerComponent, receiveComponent, featureComponent, messageSession, transportComponent);

            // set the started endpoint on CriticalError to pass the endpoint to the critical error action
            criticalError.SetEndpoint(runningInstance);

            await receiveComponent.Start().ConfigureAwait(false);

            await hostingComponent.Start().ConfigureAwait(false);

            return(runningInstance);
        }
Exemple #4
0
        public async Task <IEndpointInstance> Start(CancellationToken cancellationToken = default)
        {
            var transportInfrastructure = await transportSeam.CreateTransportInfrastructure(cancellationToken).ConfigureAwait(false);

            var pipelineCache       = pipelineComponent.BuildPipelineCache(builder);
            var messageOperations   = sendComponent.CreateMessageOperations(builder, pipelineComponent);
            var stoppingTokenSource = new CancellationTokenSource();

            var rootContext    = new RootContext(builder, messageOperations, pipelineCache, stoppingTokenSource.Token);
            var messageSession = new MessageSession(rootContext);

            await receiveComponent.Initialize(builder, recoverabilityComponent, messageOperations, pipelineComponent, pipelineCache, transportInfrastructure, cancellationToken).ConfigureAwait(false);

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
            }

            await featureComponent.Start(builder, messageSession, cancellationToken).ConfigureAwait(false);

            var runningInstance = new RunningEndpointInstance(settings, hostingComponent, receiveComponent, featureComponent, messageSession, transportInfrastructure, stoppingTokenSource);

            await receiveComponent.Start(cancellationToken).ConfigureAwait(false);

            return(runningInstance);
        }
Exemple #5
0
        public async Task <IEndpointInstance> Start()
        {
            await receiveComponent.PerformPreStartupChecks().ConfigureAwait(false);

            await transportInfrastructure.Start().ConfigureAwait(false);

            AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);

            await receiveComponent.Initialize(containerComponent, recoverabilityComponent).ConfigureAwait(false);

            await featureComponent.Start(messageSession).ConfigureAwait(false);

            var runningInstance = new RunningEndpointInstance(settings, containerComponent, receiveComponent, featureComponent, messageSession, transportInfrastructure);

            // set the started endpoint on CriticalError to pass the endpoint to the critical error action
            criticalError.SetEndpoint(runningInstance);

            receiveComponent.Start();

            return(runningInstance);
        }
        public async Task <IEndpointInstance> Start()
        {
            await transportInfrastructure.Start().ConfigureAwait(false);

            AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);

            var mainPipeline = new Pipeline <ITransportReceiveContext>(builder, settings, pipelineConfiguration.Modifications);
            var receivers    = CreateReceivers(mainPipeline);

            await InitializeReceivers(receivers).ConfigureAwait(false);

            var featureRunner = await StartFeatures(messageSession).ConfigureAwait(false);

            var runningInstance = new RunningEndpointInstance(settings, builder, receivers, featureRunner, messageSession, transportInfrastructure);

            // set the started endpoint on CriticalError to pass the endpoint to the critical error action
            criticalError.SetEndpoint(runningInstance);

            StartReceivers(receivers);

            return(runningInstance);
        }
        public async Task <IEndpointInstance> Start()
        {
            var busInterface = new StartUpBusInterface(builder);
            var busSession   = busInterface.CreateBusSession();

            await RunInstallers().ConfigureAwait(false);

            var featureRunner = await StartFeatures(busSession).ConfigureAwait(false);

            var runner = await StartStartables(busSession).ConfigureAwait(false);

            AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);

            var pipelineCollection = CreateIncomingPipelines();

            var runningInstance = new RunningEndpointInstance(builder, pipelineCollection, runner, featureRunner, busInterface);

            // set the started endpoint on CriticalError to pass the endpoint to the critical error action
            builder.Build <CriticalError>().Endpoint = runningInstance;

            await StartPipelines(pipelineCollection).ConfigureAwait(false);

            return(runningInstance);
        }