public CustomChecksStartup(IEnumerable<ICustomCheck> customChecks, ReadOnlySettings settings, CriticalError criticalError, IDispatchMessages dispatcher) { dispatchMessages = dispatcher; this.criticalError = criticalError; this.settings = settings; this.customChecks = customChecks.ToList(); }
public Configuration(Settings settings, List<Type> availableTypes, CriticalError criticalError, StartupDiagnosticEntries startupDiagnostics, string diagnosticsPath, Func<string, CancellationToken, Task> hostDiagnosticsWriter, string endpointName, IServiceCollection services, string installationUserName, bool shouldRunInstallers, List<Action<IServiceCollection>> userRegistrations) { AvailableTypes = availableTypes; CriticalError = criticalError; StartupDiagnostics = startupDiagnostics; DiagnosticsPath = diagnosticsPath; HostDiagnosticsWriter = hostDiagnosticsWriter; EndpointName = endpointName; Services = services; InstallationUserName = installationUserName; ShouldRunInstallers = shouldRunInstallers; UserRegistrations = userRegistrations; settings.ApplyHostIdDefaultIfNeeded(); HostInformation = new HostInformation(settings.HostId, settings.DisplayName, settings.Properties); }
public Task Init(Func<MessageContext, Task> onMessage, Func<ErrorContext, Task<ErrorHandleResult>> onError, CriticalError criticalError, PushSettings settings) { peekCircuitBreaker = new RepeatedFailuresOverTimeCircuitBreaker("MsmqPeek", TimeSpan.FromSeconds(30), ex => criticalError.Raise("Failed to peek " + settings.InputQueue, ex)); receiveCircuitBreaker = new RepeatedFailuresOverTimeCircuitBreaker("MsmqReceive", TimeSpan.FromSeconds(30), ex => criticalError.Raise("Failed to receive from " + settings.InputQueue, ex)); var inputAddress = MsmqAddress.Parse(settings.InputQueue); var errorAddress = MsmqAddress.Parse(settings.ErrorQueue); if (!string.Equals(inputAddress.Machine, RuntimeEnvironment.MachineName, StringComparison.OrdinalIgnoreCase)) { throw new Exception($"MSMQ Dequeuing can only run against the local machine. Invalid inputQueue name '{settings.InputQueue}'."); } inputQueue = new MessageQueue(inputAddress.FullPath, false, true, QueueAccessMode.Receive); errorQueue = new MessageQueue(errorAddress.FullPath, false, true, QueueAccessMode.Send); if (settings.RequiredTransactionMode != TransportTransactionMode.None && !QueueIsTransactional()) { throw new ArgumentException($"Queue must be transactional if you configure the endpoint to be transactional ({settings.InputQueue})."); } inputQueue.MessageReadPropertyFilter = DefaultReadPropertyFilter; if (settings.PurgeOnStartup) { inputQueue.Purge(); } receiveStrategy = receiveStrategyFactory(settings.RequiredTransactionMode); receiveStrategy.Init(inputQueue, errorQueue, onMessage, onError, criticalError); return TaskEx.CompletedTask; }
void RegisterCriticalErrorHandler() { Func <ICriticalErrorContext, Task> errorAction; settings.TryGet("onCriticalErrorAction", out errorAction); criticalError = new CriticalError(errorAction); container.RegisterSingleton(criticalError); }
public void Init(MessageQueue inputQueue, MessageQueue errorQueue, Func<MessageContext, Task> onMessage, Func<ErrorContext, Task<ErrorHandleResult>> onError, CriticalError criticalError) { this.inputQueue = inputQueue; this.errorQueue = errorQueue; this.onMessage = onMessage; this.onError = onError; this.criticalError = criticalError; }
ReceiveComponent(ReceiveConfiguration transportReceiveConfiguration, PipelineComponent pipelineComponent, CriticalError criticalError, string errorQueue) { this.transportReceiveConfiguration = transportReceiveConfiguration; this.pipelineComponent = pipelineComponent; this.criticalError = criticalError; this.errorQueue = errorQueue; }
ReceiveComponent(Configuration configuration, CriticalError criticalError, string errorQueue, TransportReceiveInfrastructure transportReceiveInfrastructure) { this.configuration = configuration; this.criticalError = criticalError; this.errorQueue = errorQueue; this.transportReceiveInfrastructure = transportReceiveInfrastructure; }
public TimerBasedPeriodicCheck(IPeriodicCheck periodicCheck, ISendMessages messageSender, Configure configure, UnicastBus unicastBus, CriticalError criticalError) { this.periodicCheck = periodicCheck; this.configure = configure; this.unicastBus = unicastBus; serviceControlBackend = new ServiceControlBackend(messageSender, configure, criticalError); timer = new Timer(Run, null, TimeSpan.Zero, periodicCheck.Interval); }
void InvokeCriticalError(CriticalError criticalError, string errorMessage, Exception exception) { #region InvokeCriticalError // 'criticalError' is an instance of the NServiceBus.CriticalError class // This instance can be resolved from the container. criticalError.Raise(errorMessage, exception); #endregion }
public async Task Start(CriticalError criticalError) { var data = await LoadExchanges().ConfigureAwait(false); cachedExchangeCollection = new ExchangeCollection(data); monitorConnection = connectionConfiguration.CreateConnection("ExchangeMonitor"); await monitorConnection.ConnectAsync().ConfigureAwait(false); monitor = new ExchangeMonitor(monitorConnection, OnNewVersion, criticalError); monitor.StartMonitoring(); }
async Task Start(CriticalError criticalError) { if (started) { return; } await subscriptionManager.Value.Start(criticalError).ConfigureAwait(false); await timeoutProcessor.Value.Start().ConfigureAwait(false); started = true; }
public ReceiveComponent(ReceiveConfiguration configuration, TransportReceiveInfrastructure receiveInfrastructure, PipelineComponent pipeline, IEventAggregator eventAggregator, CriticalError criticalError, string errorQueue) { this.configuration = configuration; this.receiveInfrastructure = receiveInfrastructure; this.pipeline = pipeline; this.eventAggregator = eventAggregator; this.criticalError = criticalError; this.errorQueue = errorQueue; }
ReceiveComponent(ReceiveConfiguration configuration, Func <IPushMessages> messagePumpFactory, PipelineComponent pipeline, IEventAggregator eventAggregator, CriticalError criticalError, string errorQueue) { this.configuration = configuration; this.messagePumpFactory = messagePumpFactory; this.pipeline = pipeline; this.eventAggregator = eventAggregator; this.criticalError = criticalError; this.errorQueue = errorQueue; }
public StartableEndpoint(SettingsHolder settings, IBuilder builder, FeatureActivator featureActivator, PipelineConfiguration pipelineConfiguration, IEventAggregator eventAggregator, TransportInfrastructure transportInfrastructure, CriticalError criticalError) { this.criticalError = criticalError; this.settings = settings; this.builder = builder; this.featureActivator = featureActivator; this.pipelineConfiguration = pipelineConfiguration; this.eventAggregator = eventAggregator; this.transportInfrastructure = transportInfrastructure; pipelineCache = new PipelineCache(builder, settings); messageSession = new MessageSession(new RootContext(builder, pipelineCache, eventAggregator)); }
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); }
public ReceiveComponent(ReceiveConfiguration configuration, TransportReceiveInfrastructure receiveInfrastructure, IPipelineExecutor mainPipelineExecutor, IEventAggregator eventAggregator, IBuilder builder, CriticalError criticalError, string errorQueue) { this.configuration = configuration; this.receiveInfrastructure = receiveInfrastructure; this.mainPipelineExecutor = mainPipelineExecutor; this.eventAggregator = eventAggregator; this.builder = builder; this.criticalError = criticalError; this.errorQueue = errorQueue; }
public ServiceControlBackend(IDispatchMessages messageSender, ReadOnlySettings settings, CriticalError criticalError) { this.settings = settings; this.messageSender = messageSender; serializer = new DataContractJsonSerializer(typeof(ReportCustomCheckResult), new DataContractJsonSerializerSettings { DateTimeFormat = new DateTimeFormat("o"), EmitTypeInformation = EmitTypeInformation.Always, }); serviceControlBackendAddress = GetServiceControlAddress(); circuitBreaker = new RepeatedFailuresOverTimeCircuitBreaker("ServiceControlConnectivity", TimeSpan.FromMinutes(2), ex => criticalError.Raise("You have ServiceControl plugins installed in your endpoint, however, this endpoint is repeatedly unable to contact the ServiceControl backend to report endpoint information.", ex)); }
public ReceiveComponent(SettingsHolder settings, ReceiveConfiguration configuration, TransportReceiveInfrastructure receiveInfrastructure, PipelineComponent pipeline, IBuilder builder, IEventAggregator eventAggregator, CriticalError criticalError, string errorQueue) { this.settings = settings; this.configuration = configuration; this.receiveInfrastructure = receiveInfrastructure; this.pipeline = pipeline; this.builder = builder; this.eventAggregator = eventAggregator; this.criticalError = criticalError; this.errorQueue = errorQueue; }
public TransportReceiver( string id, IPushMessages pushMessages, PushSettings pushSettings, PushRuntimeSettings pushRuntimeSettings, IPipelineExecutor pipelineExecutor, RecoverabilityExecutor recoverabilityExecutor, CriticalError criticalError) { this.criticalError = criticalError; Id = id; this.pushRuntimeSettings = pushRuntimeSettings; this.pipelineExecutor = pipelineExecutor; this.recoverabilityExecutor = recoverabilityExecutor; this.pushSettings = pushSettings; receiver = pushMessages; }
public Configuration(Settings settings, List <Type> availableTypes, CriticalError criticalError, StartupDiagnosticEntries startupDiagnostics, string diagnosticsPath, Func <string, Task> hostDiagnosticsWriter, string endpointName, IConfigureComponents container) { this.settings = settings; AvailableTypes = availableTypes; CriticalError = criticalError; StartupDiagnostics = startupDiagnostics; DiagnosticsPath = diagnosticsPath; HostDiagnosticsWriter = hostDiagnosticsWriter; EndpointName = endpointName; Container = container; }
public ServiceControlBackend(ISendMessages messageSender, Configure configure, CriticalError criticalError) { this.configure = configure; this.criticalError = criticalError; this.messageSender = messageSender; serializer = new JsonMessageSerializer(new SimpleMessageMapper()); serviceControlBackendAddress = GetServiceControlAddress(); VerifyIfServiceControlQueueExists(); circuitBreaker = new RepeatedFailuresOverTimeCircuitBreaker("ServiceControlConnectivity", TimeSpan.FromMinutes(2), ex => criticalError.Raise( "This endpoint is repeatedly unable to contact the ServiceControl backend to report endpoint information. You have the ServiceControl plugins installed in your endpoint. However, please ensure that the Particular ServiceControl service is installed on this machine, " + "or if running ServiceControl on a different machine, then ensure that your endpoint's app.config / web.config, AppSettings has the following key set appropriately: ServiceControl/Queue. \r\n" + @"For example: <add key=""ServiceControl/Queue"" value=""particular.servicecontrol@machine""/>" + "\r\n", ex)); }
public StartableEndpoint(SettingsHolder settings, ContainerComponent containerComponent, FeatureComponent featureComponent, TransportComponent transportComponent, ReceiveComponent receiveComponent, CriticalError criticalError, PipelineComponent pipelineComponent, RecoverabilityComponent recoverabilityComponent, HostingComponent hostingComponent) { this.criticalError = criticalError; this.settings = settings; this.containerComponent = containerComponent; this.featureComponent = featureComponent; this.transportComponent = transportComponent; this.receiveComponent = receiveComponent; this.pipelineComponent = pipelineComponent; this.recoverabilityComponent = recoverabilityComponent; this.hostingComponent = hostingComponent; }
public ReceiveComponent(ReceiveConfiguration configuration, TransportReceiveInfrastructure receiveInfrastructure, IPipelineCache pipelineCache, PipelineConfiguration pipelineConfiguration, IEventAggregator eventAggregator, IBuilder builder, CriticalError criticalError, string errorQueue, IMessageMapper messageMapper) { this.configuration = configuration; this.receiveInfrastructure = receiveInfrastructure; this.pipelineCache = pipelineCache; this.pipelineConfiguration = pipelineConfiguration; this.eventAggregator = eventAggregator; this.builder = builder; this.criticalError = criticalError; this.errorQueue = errorQueue; this.messageMapper = messageMapper; }
public Configuration(Settings settings, List <Type> availableTypes, CriticalError criticalError, StartupDiagnosticEntries startupDiagnostics, string diagnosticsPath, Func <string, Task> hostDiagnosticsWriter, string endpointName, IConfigureComponents container, string installationUserName, bool shouldRunInstallers) { AvailableTypes = availableTypes; CriticalError = criticalError; StartupDiagnostics = startupDiagnostics; DiagnosticsPath = diagnosticsPath; HostDiagnosticsWriter = hostDiagnosticsWriter; EndpointName = endpointName; Container = container; InstallationUserName = installationUserName; ShouldRunInstallers = shouldRunInstallers; settings.ApplyHostIdDefaultIfNeeded(); HostInformation = new HostInformation(settings.HostId, settings.DisplayName, settings.Properties); }
public ExchangeMonitor(IEventStoreConnection connection, Action <ExchangeDataCollection> newVersionDetectedCallback, CriticalError criticalError) { this.connection = connection; this.newVersionDetectedCallback = newVersionDetectedCallback; circuitBreaker = new RepeatedFailuresOverTimeCircuitBreaker("EventStoreExchangeMonitor", TimeSpan.FromSeconds(30), ex => criticalError.Raise("Failed to re-subscribe to changes in exchanges.", ex)); }
public void Init(MessageQueue inputQueue, MessageQueue errorQueue, Func <MessageContext, Task> onMessage, Func <ErrorContext, Task <ErrorHandleResult> > onError, CriticalError criticalError) { this.inputQueue = inputQueue; this.errorQueue = errorQueue; this.onMessage = onMessage; this.onError = onError; this.criticalError = criticalError; }
public StartableEndpoint(SettingsHolder settings, IBuilder builder, FeatureActivator featureActivator, TransportInfrastructure transportInfrastructure, ReceiveComponent receiveComponent, CriticalError criticalError, IMessageSession messageSession) { this.criticalError = criticalError; this.settings = settings; this.builder = builder; this.featureActivator = featureActivator; this.transportInfrastructure = transportInfrastructure; this.receiveComponent = receiveComponent; this.messageSession = messageSession; }
public StartableEndpoint(SettingsHolder settings, ContainerComponent containerComponent, FeatureComponent featureComponent, TransportInfrastructure transportInfrastructure, ReceiveComponent receiveComponent, CriticalError criticalError, IMessageSession messageSession, RecoverabilityComponent recoverabilityComponent) { this.criticalError = criticalError; this.settings = settings; this.containerComponent = containerComponent; this.featureComponent = featureComponent; this.transportInfrastructure = transportInfrastructure; this.receiveComponent = receiveComponent; this.messageSession = messageSession; this.recoverabilityComponent = recoverabilityComponent; }
void RegisterCriticalErrorHandler() { Func<ICriticalErrorContext, Task> errorAction; settings.TryGet("onCriticalErrorAction", out errorAction); criticalError = new CriticalError(errorAction); container.RegisterSingleton(criticalError); }
public Task Init(Func <MessageContext, Task> onMessage, Func <ErrorContext, Task <ErrorHandleResult> > onError, CriticalError criticalError, PushSettings settings) { this.onMessage = onMessage; this.onError = onError; this.criticalError = criticalError; transactionMode = settings.RequiredTransactionMode; PathChecker.ThrowForBadPath(settings.InputQueue, "InputQueue"); messagePumpBasePath = Path.Combine(basePath, settings.InputQueue); bodyDir = Path.Combine(messagePumpBasePath, BodyDirName); delayedDir = Path.Combine(messagePumpBasePath, DelayedDirName); pendingTransactionDir = Path.Combine(messagePumpBasePath, PendingDirName); committedTransactionDir = Path.Combine(messagePumpBasePath, CommittedDirName); if (settings.PurgeOnStartup) { if (Directory.Exists(messagePumpBasePath)) { Directory.Delete(messagePumpBasePath, true); } } delayedMessagePoller = new DelayedMessagePoller(messagePumpBasePath, delayedDir); return(Task.CompletedTask); }
public Task Init(Func <MessageContext, Task> onMessage, Func <ErrorContext, Task <ErrorHandleResult> > onError, CriticalError criticalError, PushSettings settings) { peekCircuitBreaker = new RepeatedFailuresOverTimeCircuitBreaker("MsmqPeek", TimeSpan.FromSeconds(30), ex => criticalError.Raise("Failed to peek " + settings.InputQueue, ex)); receiveCircuitBreaker = new RepeatedFailuresOverTimeCircuitBreaker("MsmqReceive", TimeSpan.FromSeconds(30), ex => criticalError.Raise("Failed to receive from " + settings.InputQueue, ex)); var inputAddress = MsmqAddress.Parse(settings.InputQueue); var errorAddress = MsmqAddress.Parse(settings.ErrorQueue); if (!string.Equals(inputAddress.Machine, RuntimeEnvironment.MachineName, StringComparison.OrdinalIgnoreCase)) { throw new Exception($"MSMQ Dequeuing can only run against the local machine. Invalid inputQueue name '{settings.InputQueue}'."); } inputQueue = new MessageQueue(inputAddress.FullPath, false, true, QueueAccessMode.Receive); errorQueue = new MessageQueue(errorAddress.FullPath, false, true, QueueAccessMode.Send); if (settings.RequiredTransactionMode != TransportTransactionMode.None && !QueueIsTransactional()) { throw new ArgumentException($"Queue must be transactional if you configure the endpoint to be transactional ({settings.InputQueue})."); } inputQueue.MessageReadPropertyFilter = DefaultReadPropertyFilter; if (settings.PurgeOnStartup) { inputQueue.Purge(); } receiveStrategy = receiveStrategyFactory(settings.RequiredTransactionMode); receiveStrategy.Init(inputQueue, errorQueue, onMessage, onError, criticalError); return(TaskEx.CompletedTask); }
public Task Init(Func <MessageContext, Task> onMessage, Func <ErrorContext, Task <ErrorHandleResult> > onError, CriticalError criticalError, PushSettings settings) { return(Task.CompletedTask); }
public Task Start(CriticalError criticalError) { return(exchangeManager.Start(criticalError)); }
public async Task Init(Func <MessageContext, Task> onMessage, Func <ErrorContext, Task <ErrorHandleResult> > onError, CriticalError criticalError, PushSettings settings) { pipeline = onMessage; this.onError = onError; inputQueue = settings.InputQueue; receiveCircuitBreaker = new RepeatedFailuresOverTimeCircuitBreaker("EventStoreReceive", TimeSpan.FromSeconds(30), ex => criticalError.Raise("Failed to receive from " + settings.InputQueue, ex)); this.criticalError = criticalError; if (settings.PurgeOnStartup) { //inputQueue.Purge(); } await connection.ConnectAsync().ConfigureAwait(false); await onStart(criticalError).ConfigureAwait(false); }
void RegisterCriticalErrorHandler() { settings.TryGet("onCriticalErrorAction", out Func <ICriticalErrorContext, Task> errorAction); criticalError = new CriticalError(errorAction); containerComponent.ContainerConfiguration.RegisterSingleton(criticalError); }
public Task Init(Func<PushContext, Task> pipe, CriticalError criticalError, PushSettings settings) { throw new NotImplementedException(); }