public async Task EnsureStarted(CancellationToken cancellationToken) { try { await startStopSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false); if (ingestionEndpoint != null) { return; //Already started } var rawConfiguration = rawEndpointFactory.CreateAuditIngestor(inputEndpoint, onMessage); rawConfiguration.Settings.Set("onCriticalErrorAction", (Func <ICriticalErrorContext, Task>)OnCriticalErrorAction); rawConfiguration.CustomErrorHandlingPolicy(errorHandlingPolicy); var startableRaw = await RawEndpoint.Create(rawConfiguration).ConfigureAwait(false); await initialize(startableRaw).ConfigureAwait(false); ingestionEndpoint = await startableRaw.Start() .ConfigureAwait(false); } finally { startStopSemaphore.Release(); } }
public async Task EnsureStarted(CancellationToken cancellationToken) { try { await startStopSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false); if (ingestionEndpoint != null) { return; //Already started } var rawConfiguration = rawEndpointFactory.CreateRawEndpointConfiguration( errorQueue, (messageContext, dispatcher) => errorIngestor.Ingest(messageContext)); rawConfiguration.Settings.Set("onCriticalErrorAction", (Func <ICriticalErrorContext, Task>)OnCriticalErrorAction); rawConfiguration.CustomErrorHandlingPolicy(new ErrorIngestionFaultPolicy(importFailuresHandler)); var startableRaw = await RawEndpoint.Create(rawConfiguration).ConfigureAwait(false); await errorIngestor.Initialize(startableRaw).ConfigureAwait(false); ingestionEndpoint = await startableRaw.Start() .ConfigureAwait(false); } finally { startStopSemaphore.Release(); } }
public async Task <IStartableRawEndpoint> Create() { startable = await RawEndpoint.Create(config); config = null; return(this); }
public async Task Run(string username) { var transportSettings = MapSettings(settings); var transportCustomization = settings.LoadTransportCustomization(); var factory = new RawEndpointFactory(settings, transportSettings, transportCustomization); var config = factory.CreateAuditIngestor(settings.AuditQueue, (context, dispatcher) => Task.CompletedTask); if (settings.SkipQueueCreation) { log.Info("Skipping queue creation"); } else { var additionalQueues = new List <string> { $"{settings.ServiceName}.Errors" }; if (settings.ForwardAuditMessages && settings.AuditLogQueue != null) { additionalQueues.Add(settings.AuditLogQueue); } config.AutoCreateQueues(additionalQueues.ToArray(), username); } //No need to start the raw endpoint to create queues await RawEndpoint.Create(config).ConfigureAwait(false); }
public async Task Start() { leftStartable = await RawEndpoint.Create(leftConfig).ConfigureAwait(false); rightStartable = await RawEndpoint.Create(rightConfig).ConfigureAwait(false); leftSubscribeRouter = CreateSubscribeRouter(leftStartable.Settings.Get <TransportInfrastructure>()); rightSubscribeRouter = CreateSubscribeRouter(rightStartable.Settings.Get <TransportInfrastructure>()); leftEndpoint = await leftStartable.Start().ConfigureAwait(false); rightEndpoint = await rightStartable.Start().ConfigureAwait(false); }
public override async Task Start(CancellationToken token) { var startable = await RawEndpoint.Create(config).ConfigureAwait(false); if (!sendOnly) { endpoint = await startable.Start().ConfigureAwait(false); } else { endpoint = startable; } await onStarting(endpoint).ConfigureAwait(false); }
public Task CreateQueue() { var config = createEndpointConfiguration(); return(RawEndpoint.Create(config)); }
public async Task Run(string username) { var transportSettings = MapSettings(settings); var transportCustomization = settings.LoadTransportCustomization(); var factory = new RawEndpointFactory(settings, transportSettings, transportCustomization); var config = factory.CreateAuditIngestor(settings.AuditQueue, (context, dispatcher) => Task.CompletedTask); if (settings.SkipQueueCreation) { log.Info("Skipping queue creation"); } else { var additionalQueues = new List <string> { $"{settings.ServiceName}.Errors" }; if (settings.ForwardAuditMessages && settings.AuditLogQueue != null) { additionalQueues.Add(settings.AuditLogQueue); } config.AutoCreateQueues(additionalQueues.ToArray(), username); } //No need to start the raw endpoint to create queues await RawEndpoint.Create(config).ConfigureAwait(false); var configuration = new EndpointConfiguration(settings.ServiceName); var assemblyScanner = configuration.AssemblyScanner(); assemblyScanner.ExcludeAssemblies("ServiceControl.Plugin"); if (excludeAssemblies != null) { assemblyScanner.ExcludeAssemblies(excludeAssemblies); } configuration.EnableInstallers(username); if (settings.SkipQueueCreation) { log.Info("Skipping queue creation"); configuration.DoNotCreateQueues(); } var containerBuilder = new ContainerBuilder(); containerBuilder.RegisterInstance(transportSettings).SingleInstance(); var loggingSettings = new LoggingSettings(settings.ServiceName); containerBuilder.RegisterInstance(loggingSettings).SingleInstance(); var documentStore = new EmbeddableDocumentStore(); containerBuilder.RegisterInstance(documentStore).As <IDocumentStore>().ExternallyOwned(); containerBuilder.RegisterInstance(settings).SingleInstance(); containerBuilder.RegisterType <MigrateKnownEndpoints>().As <INeedToInstallSomething>(); using (documentStore) using (var container = containerBuilder.Build()) { await NServiceBusFactory.Create(settings, transportCustomization, transportSettings, loggingSettings, container, ctx => { }, documentStore, configuration, false) .ConfigureAwait(false); } }
async Task Create() { endpoint = await RawEndpoint.Create(config).ConfigureAwait(false); }