Task <IStartableEndpoint> PerformConfiguration(Action <EndpointConfiguration> moreConfiguration = null) { var configuration = new EndpointConfiguration(endpointNameToUse); configuration.DefineCriticalErrorAction(OnCriticalError); if (SafeRoleEnvironment.IsAvailable) { if (!IsHostedIn.ChildHostProcess()) { configuration.AzureConfigurationSource(); } var host = SafeRoleEnvironment.CurrentRoleName; var instance = SafeRoleEnvironment.CurrentRoleInstanceId; var displayName = $"{host}_{instance}"; configuration .UniquelyIdentifyRunningInstance() .UsingNames(instance, host) .UsingCustomDisplayName(displayName); } moreConfiguration?.Invoke(configuration); specifier.Customize(configuration); return(Endpoint.Create(configuration)); }
void PerformConfiguration(Action <BusConfiguration> moreConfiguration = null) { var loggingConfigurers = profileManager.GetLoggingConfigurer(); foreach (var loggingConfigurer in loggingConfigurers) { loggingConfigurer.Configure(specifier); } var configuration = new BusConfiguration(); configuration.EndpointName(endpointNameToUse); configuration.AssembliesToScan(assembliesToScan); configuration.DefineCriticalErrorAction(OnCriticalError); if (SafeRoleEnvironment.IsAvailable) { if (!IsHostedIn.ChildHostProcess()) { configuration.AzureConfigurationSource(); } var host = SafeRoleEnvironment.CurrentRoleName; var instance = SafeRoleEnvironment.CurrentRoleInstanceId; var hostId = DeterministicGuid(instance, host); configuration .UniquelyIdentifyRunningInstance() .UsingCustomIdentifier(hostId) .UsingNames(instance, host); } if (moreConfiguration != null) { moreConfiguration(configuration); } specifier.Customize(configuration); RoleManager.TweakConfigurationBuilder(specifier, configuration); bus = (UnicastBus)Bus.Create(configuration); }