public virtual async Task StartEndpoint() { // Resolve via container, afterall, why register it? //var container = _endPointConfig.GetEndpointContainer(); //_endpointInstance = container.Resolve<IEndpointInstance>(); _endpointInstance = await _startableEndpoint.Start().ConfigureAwait(false); }
private void AssumeEndpointInstanceBuilderIsInitialised() { _endpointInstanceBuilder = Substitute.For <IEndpointInstanceBuilder>(); _endpointInstanceBuilder.ReturnsForAll(_endpointInstanceBuilder); _startableEndpoint = Substitute.For <IStartableEndpoint>(); _endpointInstanceBuilder.Build().Returns(Task.FromResult(_startableEndpoint)); _endpointInstance = Substitute.For <IEndpointInstance>(); _startableEndpoint.Start().Returns(Task.FromResult(_endpointInstance)); }
public async Task <IEndpointInstance> Start(IStartableEndpoint startableEndpoint) { var hostStartupDiagnosticsWriter = HostStartupDiagnosticsWriterFactory.GetDiagnosticsWriter(configuration); await hostStartupDiagnosticsWriter.Write(configuration.StartupDiagnostics.entries).ConfigureAwait(false); var endpointInstance = await startableEndpoint.Start().ConfigureAwait(false); configuration.CriticalError.SetEndpoint(endpointInstance); return(endpointInstance); }
async Task Startup() { #region Hosting-Startup EndpointConfiguration endpointConfiguration = new EndpointConfiguration("EndpointName"); //Apply configuration IStartableEndpoint startableEndpoint = await Endpoint.Create(endpointConfiguration); IEndpointInstance endpointInstance = await startableEndpoint.Start(); //Shortcut IEndpointInstance endpointInstance2 = await Endpoint.Start(endpointConfiguration); #endregion }
async Task Startup() { #region Hosting-Startup EndpointConfiguration endpointConfiguration = new EndpointConfiguration("TheEndpointName"); //Apply configuration IInitializableEndpoint initializableEndpoint = Endpoint.Prepare(endpointConfiguration); IStartableEndpoint startableEndpoint = await initializableEndpoint.Initialize(); IEndpointInstance endpointInstance = await startableEndpoint.Start(); //Shortcut IEndpointInstance endpointInstance2 = await Endpoint.Start(endpointConfiguration); #endregion }
public async Task Startup() { #region Hosting-Startup BusConfiguration busConfiguration = new BusConfiguration(); //Apply configuration IInitializableEndpoint initializableEndpoint = Endpoint.Prepare(busConfiguration); IStartableEndpoint startableEndpoint = await initializableEndpoint.Initialize(); IEndpointInstance endpointInstance = await startableEndpoint.Start(); //Shortcut IEndpointInstance endpointInstance2 = await Endpoint.Start(busConfiguration); #endregion }
async Task GettingStartedUsage() { #region AzureServiceBusTransportGettingStarted 7 EndpointConfiguration endpointConfiguration = new EndpointConfiguration("myendpoint"); endpointConfiguration.UsePersistence <InMemoryPersistence>(); endpointConfiguration.SendFailedMessagesTo("error"); var transport = endpointConfiguration.UseTransport <AzureServiceBusTransport>(); transport.UseTopology <ForwardingTopology>(); transport.ConnectionString("Paste connectionstring here"); IStartableEndpoint initializableEndpoint = await Endpoint.Create(endpointConfiguration); IEndpointInstance endpoint = await initializableEndpoint.Start(); #endregion }
public async Task Start(CancellationToken token) { try { endpointInstance = await startable.Start().ConfigureAwait(false); if (token.IsCancellationRequested) { throw new OperationCanceledException("Endpoint start was aborted"); } } catch (Exception ex) { Logger.Error("Failed to start endpoint " + configuration.EndpointName, ex); throw; } }
static async Task AsyncMain() { Console.Title = "Samples.MultiTenant.Receiver"; Configuration sharedDatabaseConfiguration = CreateBasicNHibernateConfig(); Configuration tenantDatabasesConfiguration = CreateBasicNHibernateConfig(); ModelMapper mapper = new ModelMapper(); mapper.AddMapping <OrderMap>(); tenantDatabasesConfiguration.AddMapping(mapper.CompileMappingForAllExplicitlyAddedEntities()); EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.MultiTenant.Receiver"); endpointConfiguration.UseSerialization <JsonSerializer>(); endpointConfiguration.LimitMessageProcessingConcurrencyTo(1); endpointConfiguration.SendFailedMessagesTo("error"); #region ReceiverConfiguration var persistence = endpointConfiguration.UsePersistence <NHibernatePersistence>(); persistence.UseConfiguration(tenantDatabasesConfiguration); persistence.UseSubscriptionStorageConfiguration(sharedDatabaseConfiguration); persistence.UseTimeoutStorageConfiguration(sharedDatabaseConfiguration); persistence.DisableSchemaUpdate(); endpointConfiguration.EnableOutbox(); SettingsHolder settingsHolder = endpointConfiguration.GetSettings(); settingsHolder.Set("NHibernate.Timeouts.AutoUpdateSchema", true); settingsHolder.Set("NHibernate.Subscriptions.AutoUpdateSchema", true); #endregion #region ReplaceOpenSqlConnection endpointConfiguration.Pipeline.Register <ExtractTenantConnectionStringBehavior.Registration>(); #endregion #region RegisterPropagateTenantIdBehavior endpointConfiguration.Pipeline.Register <PropagateOutgoingTenantIdBehavior.Registration>(); endpointConfiguration.Pipeline.Register <PropagateIncomingTenantIdBehavior.Registration>(); #endregion endpointConfiguration.DisableFeature <SecondLevelRetries>(); #region CreateSchema #endregion IStartableEndpoint startableEndpoint = await Endpoint.Create(endpointConfiguration); IEndpointInstance endpoint = null; CreateSchema(tenantDatabasesConfiguration, "A"); CreateSchema(tenantDatabasesConfiguration, "B"); try { endpoint = await startableEndpoint.Start(); Console.WriteLine("Press any key to exit"); Console.ReadKey(); } finally { if (endpoint != null) { await endpoint.Stop(); } } }