本文整理汇总了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
}
示例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
}
示例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();
}
}
示例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);
}