当前位置: 首页>>代码示例>>C#>>正文


C# BusConfiguration.UniquelyIdentifyRunningInstance方法代码示例

本文整理汇总了C#中BusConfiguration.UniquelyIdentifyRunningInstance方法的典型用法代码示例。如果您正苦于以下问题:C# BusConfiguration.UniquelyIdentifyRunningInstance方法的具体用法?C# BusConfiguration.UniquelyIdentifyRunningInstance怎么用?C# BusConfiguration.UniquelyIdentifyRunningInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BusConfiguration的用法示例。


在下文中一共展示了BusConfiguration.UniquelyIdentifyRunningInstance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

        public void Start()
        {
            #region HostIdFixer 5.1

            BusConfiguration busConfiguration = new BusConfiguration();
            busConfiguration.UniquelyIdentifyRunningInstance()
                .UsingNames("endpointName", Environment.MachineName);
            // or
            Guid hostId = CreateMyUniqueIdThatIsTheSameAcrossRestarts();
            busConfiguration.UniquelyIdentifyRunningInstance()
                .UsingCustomIdentifier(hostId);
            
            #endregion
        }
开发者ID:cdnico,项目名称:docs.particular.net,代码行数:14,代码来源:HostIdFixer_5_1.cs

示例2: HostIdFixerCodeOnly

        HostIdFixerCodeOnly(BusConfiguration busConfiguration)
        {
            #region HostIdFixer 5.1

            HostInfoSettings hostInfoSettings = busConfiguration.UniquelyIdentifyRunningInstance();
            hostInfoSettings.UsingNames("endpointName", Environment.MachineName);
            // or
            Guid hostId = CreateMyUniqueIdThatIsTheSameAcrossRestarts();
            hostInfoSettings.UsingCustomIdentifier(hostId);

            #endregion
        }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:12,代码来源:HostIdFixerCodeOnly.cs

示例3: Main

		static void Main( string[] args )
		{
			var cfg = new BusConfiguration();
			cfg.UniquelyIdentifyRunningInstance()
				.UsingCustomIdentifier( new Guid( "{41E0F4CE-A4AE-4A30-8F78-B4CC3E912ABD}" ) );

			cfg.EnableInstallers();

			var embeddedSore = new EmbeddableDocumentStore
			{
				ResourceManagerId = new Guid( "{46FFEA87-77A7-43A7-88D3-79778E677D52}" ),
				DataDirectory = @"~\RavenDB\Data"
			}.Initialize();

			cfg.UsePersistence<RavenDBPersistence>()
				.DoNotSetupDatabasePermissions()
				.SetDefaultDocumentStore( embeddedSore );

			cfg.Conventions()
				.DefiningCommandsAs( t => t.Namespace != null && t.Namespace.EndsWith( ".Commands" ) )
				.DefiningEventsAs( t => t.Namespace != null && t.Namespace.EndsWith( ".Events" ) );

			cfg.LoadMessageHandlers(
				First<Handlers.SecurityHandler>
					.Then<Handlers.ValidationHandler>()
			);

			using( var bus = Bus.Create( cfg ).Start() )
			{
				bus.SendLocal( new Commands.StartSagaCommand()
				{
					Sample = "Hi, there!"
				} );

				Console.Read();
			}
		}
开发者ID:modulexcite,项目名称:NServiceBus.Samples,代码行数:37,代码来源:Program.cs

示例4: PerformConfiguration

        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);
           
            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);
        }
开发者ID:mjhilton,项目名称:NServiceBus.Azure,代码行数:38,代码来源:GenericHost.cs


注:本文中的BusConfiguration.UniquelyIdentifyRunningInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。