Example #1
0
        public void Initialize(ReceiveConfiguration receiveConfiguration, HostingComponent hostingComponent)
        {
            if (settings.GetOrDefault <bool>("Endpoint.SendOnly"))
            {
                //Message recoverability is only relevant for endpoints receiving messages.
                return;
            }

            hostInformation = hostingComponent.HostInformation;

            transactionsOn = receiveConfiguration.TransactionMode != TransportTransactionMode.None;

            var errorQueue = settings.ErrorQueueAddress();

            settings.Get <QueueBindings>().BindSending(errorQueue);

            var delayedRetryConfig = GetDelayedRetryConfig();

            var immediateRetryConfig = GetImmediateRetryConfig();

            var failedConfig = new FailedConfig(errorQueue, settings.UnrecoverableExceptions());

            recoverabilityConfig = new RecoverabilityConfig(immediateRetryConfig, delayedRetryConfig, failedConfig);

            hostingComponent.AddStartupDiagnosticsSection("Recoverability", new
            {
                ImmediateRetries           = recoverabilityConfig.Immediate.MaxNumberOfRetries,
                DelayedRetries             = recoverabilityConfig.Delayed.MaxNumberOfRetries,
                DelayedRetriesTimeIncrease = recoverabilityConfig.Delayed.TimeIncrease.ToString("g"),
                recoverabilityConfig.Failed.ErrorQueue,
                UnrecoverableExceptions = recoverabilityConfig.Failed.UnrecoverableExceptionTypes.Select(t => t.FullName).ToArray()
            });

            WireUpLegacyNotifications();
        }
Example #2
0
        public static HostingComponent Initialize(Configuration configuration,
                                                  ContainerComponent containerComponent,
                                                  PipelineSettings pipelineSettings)
        {
            var hostingComponent = new HostingComponent(configuration);

            containerComponent.ContainerConfiguration.ConfigureComponent(() => hostingComponent.HostInformation, DependencyLifecycle.SingleInstance);

            pipelineSettings.Register("AuditHostInformation", new AuditHostInformationBehavior(hostingComponent.HostInformation, configuration.EndpointName), "Adds audit host information");
            pipelineSettings.Register("AddHostInfoHeaders", new AddHostInfoHeadersBehavior(hostingComponent.HostInformation, configuration.EndpointName), "Adds host info headers to outgoing headers");


            hostingComponent.AddStartupDiagnosticsSection("Hosting", new
            {
                hostingComponent.HostInformation.HostId,
                HostDisplayName = hostingComponent.HostInformation.DisplayName,
                RuntimeEnvironment.MachineName,
                OSPlatform = Environment.OSVersion.Platform,
                OSVersion  = Environment.OSVersion.VersionString,
                GCSettings.IsServerGC,
                GCLatencyMode = GCSettings.LatencyMode,
                Environment.ProcessorCount,
                Environment.Is64BitProcess,
                CLRVersion = Environment.Version,
                Environment.WorkingSet,
                Environment.SystemPageSize,
                HostName = Dns.GetHostName(),
                Environment.UserName,
                PathToExe = PathUtilities.SanitizedPath(Environment.CommandLine)
            });

            return(hostingComponent);
        }
Example #3
0
        public static ReceiveComponent Initialize(ReceiveConfiguration receiveConfiguration,
                                                  TransportComponent transportComponent,
                                                  PipelineComponent pipeline,
                                                  EventAggregator eventAggregator,
                                                  CriticalError criticalError,
                                                  string errorQueue,
                                                  HostingComponent hostingComponent)
        {
            Func <IPushMessages> messagePumpFactory = null;

            //we don't need the message pump factory for send-only endpoints
            if (receiveConfiguration != null)
            {
                messagePumpFactory = transportComponent.GetMessagePumpFactory();
            }

            var receiveComponent = new ReceiveComponent(receiveConfiguration,
                                                        messagePumpFactory,
                                                        pipeline,
                                                        eventAggregator,
                                                        criticalError,
                                                        errorQueue);

            receiveComponent.BindQueues(transportComponent.QueueBindings);

            if (receiveConfiguration != null)
            {
                hostingComponent.AddStartupDiagnosticsSection("Receiving", new
                {
                    receiveConfiguration.LocalAddress,
                    receiveConfiguration.InstanceSpecificQueue,
                    receiveConfiguration.LogicalAddress,
                    receiveConfiguration.PurgeOnStartup,
                    receiveConfiguration.QueueNameBase,
                    TransactionMode = receiveConfiguration.TransactionMode.ToString("G"),
                    receiveConfiguration.PushRuntimeSettings.MaxConcurrency,
                    Satellites = receiveConfiguration.SatelliteDefinitions.Select(s => new
                    {
                        s.Name,
                        s.ReceiveAddress,
                        TransactionMode = s.RequiredTransportTransactionMode.ToString("G"),
                        s.RuntimeSettings.MaxConcurrency
                    }).ToArray()
                });
            }

            return(receiveComponent);
        }