本文整理汇总了C#中EndpointConfiguration.ScaleOut方法的典型用法代码示例。如果您正苦于以下问题:C# EndpointConfiguration.ScaleOut方法的具体用法?C# EndpointConfiguration.ScaleOut怎么用?C# EndpointConfiguration.ScaleOut使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EndpointConfiguration
的用法示例。
在下文中一共展示了EndpointConfiguration.ScaleOut方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AsyncMain
static async Task AsyncMain()
{
Console.Title = "Samples.WcfCallbacks.Endpoint";
EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.WcfCallbacks.Endpoint");
endpointConfiguration.ScaleOut()
.InstanceDiscriminator("1");
endpointConfiguration.UseSerialization<JsonSerializer>();
endpointConfiguration.UsePersistence<InMemoryPersistence>();
endpointConfiguration.EnableInstallers();
endpointConfiguration.SendFailedMessagesTo("error");
#region startbus
IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
try
{
using (StartWcfHost(endpoint))
{
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
}
finally
{
await endpoint.Stop();
}
#endregion
}
示例2: IndividualizeQueues
IndividualizeQueues(EndpointConfiguration endpointConfiguration)
{
#region UniqueQueuePerEndpointInstanceDiscriminator
endpointConfiguration.ScaleOut()
.InstanceDiscriminator("MyInstanceID");
#endregion
}
示例3: StartBus
async Task StartBus()
{
EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.Callbacks.WebSender");
endpointConfiguration.UseSerialization<JsonSerializer>();
endpointConfiguration.UsePersistence<InMemoryPersistence>();
endpointConfiguration.EnableInstallers();
endpointConfiguration.SendFailedMessagesTo("error");
endpointConfiguration.ScaleOut()
.InstanceDiscriminator("1");
Endpoint = await NServiceBus.Endpoint.Start(endpointConfiguration);
}
示例4: AsyncMain
static async Task AsyncMain()
{
EndpointConfiguration endpointConfiguration = new EndpointConfiguration();
endpointConfiguration.EndpointName("Server");
string discriminator = ConfigurationManager.AppSettings["InstanceId"];
endpointConfiguration.ScaleOut().InstanceDiscriminator(discriminator);
endpointConfiguration.UsePersistence<InMemoryPersistence>();
endpointConfiguration.SendFailedMessagesTo("error");
IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
Console.WriteLine("Press enter to exit.");
Console.ReadLine();
await endpoint.Stop();
}
示例5: Simple
async Task Simple(EndpointConfiguration endpointConfiguration, IEndpointInstance endpoint, SendOptions sendOptions)
{
#region 5to6-Callbacks-InstanceId
endpointConfiguration.ScaleOut().InstanceDiscriminator("uniqueId");
#endregion
#region 5to6-Callbacks
RequestMessage message = new RequestMessage();
ResponseMessage response = await endpoint.Request<ResponseMessage>(message, sendOptions);
#endregion
}
示例6: AsyncMain
static async Task AsyncMain()
{
Console.Title = "Samples.Callbacks.Sender";
var endpointConfiguration = new EndpointConfiguration("Samples.Callbacks.Sender");
endpointConfiguration.UseSerialization<JsonSerializer>();
endpointConfiguration.ScaleOut()
.InstanceDiscriminator("1");
endpointConfiguration.UsePersistence<InMemoryPersistence>();
endpointConfiguration.EnableInstallers();
endpointConfiguration.SendFailedMessagesTo("error");
var endpointInstance = await Endpoint.Start(endpointConfiguration)
.ConfigureAwait(false);
try
{
Console.WriteLine("Press 'E' to send a message with an enum return");
Console.WriteLine("Press 'I' to send a message with an int return");
Console.WriteLine("Press 'O' to send a message with an object return");
Console.WriteLine("Press any other key to exit");
while (true)
{
var key = Console.ReadKey();
Console.WriteLine();
if (key.Key == ConsoleKey.E)
{
await SendEnumMessage(endpointInstance)
.ConfigureAwait(false);
continue;
}
if (key.Key == ConsoleKey.I)
{
await SendIntMessage(endpointInstance)
.ConfigureAwait(false);
continue;
}
if (key.Key == ConsoleKey.O)
{
await SendObjectMessage(endpointInstance)
.ConfigureAwait(false);
continue;
}
return;
}
}
finally
{
await endpointInstance.Stop()
.ConfigureAwait(false);
}
}
示例7: Application_Start
protected void Application_Start(object sender, EventArgs e)
{
#region ApplicationStart
EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.AsyncPages.WebApplication");
endpointConfiguration.ScaleOut()
.InstanceDiscriminator("1");
endpointConfiguration.UseSerialization<JsonSerializer>();
endpointConfiguration.EnableInstallers();
endpointConfiguration.UsePersistence<InMemoryPersistence>();
Endpoint = NServiceBus.Endpoint.Start(endpointConfiguration).GetAwaiter().GetResult();
#endregion
}
示例8: Simple
async void Simple(EndpointConfiguration endpointConfiguration, IEndpointInstance endpoint, SendOptions sendOptions, ILog log)
{
#region Callbacks-InstanceId
endpointConfiguration.ScaleOut().InstanceDiscriminator("uniqueId");
#endregion
#region ObjectCallback
Message message = new Message();
ResponseMessage response = await endpoint.Request<ResponseMessage>(message, sendOptions);
log.Info("Callback received with response:" + response.Property);
#endregion
}
示例9: AsyncMain
static async Task AsyncMain()
{
Console.Title = "Samples.CustomDistributionStrategy.Server2";
var endpointConfiguration = new EndpointConfiguration("Samples.CustomDistributionStrategy.Server");
var discriminator = ConfigurationManager.AppSettings["InstanceId"];
var scaleOut = endpointConfiguration.ScaleOut();
scaleOut.InstanceDiscriminator(discriminator);
endpointConfiguration.UsePersistence<InMemoryPersistence>();
endpointConfiguration.SendFailedMessagesTo("error");
var endpointInstance = await Endpoint.Start(endpointConfiguration)
.ConfigureAwait(false);
Console.WriteLine("Press enter to exit.");
Console.ReadLine();
await endpointInstance.Stop()
.ConfigureAwait(false);
}
示例10: Main
static void Main()
{
Console.Title = "Samples.Scaleout.Worker1";
#region Workerstartup
EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.Scaleout.Worker");
string discriminator = ConfigurationManager.AppSettings["InstanceId"];
endpointConfiguration.ScaleOut().InstanceDiscriminator(discriminator);
string masterNodeAddress = ConfigurationManager.AppSettings["MasterNodeAddress"];
string masterNodeControlAddress = ConfigurationManager.AppSettings["MasterNodeControlAddress"];
endpointConfiguration.EnlistWithLegacyMSMQDistributor(masterNodeAddress, masterNodeControlAddress, 10);
#endregion
endpointConfiguration.UseSerialization<JsonSerializer>();
endpointConfiguration.UsePersistence<InMemoryPersistence>();
endpointConfiguration.EnableInstallers();
Run(endpointConfiguration).GetAwaiter().GetResult();
}
示例11: Main
static void Main()
{
var endpointConfiguration = new EndpointConfiguration("Samples.Scaleout.Worker");
endpointConfiguration.ScaleOut()
.InstanceDiscriminator(ConfigurationManager.AppSettings["InstanceId"]);
endpointConfiguration
.EnlistWithLegacyMSMQDistributor(
ConfigurationManager.AppSettings["DistributorAddress"],
ConfigurationManager.AppSettings["DistributorControlAddress"],
10);
endpointConfiguration.UseSerialization<JsonSerializer>();
endpointConfiguration.UsePersistence<InMemoryPersistence>();
endpointConfiguration.SendFailedMessagesTo("error");
endpointConfiguration.EnableInstallers();
endpointConfiguration.Conventions()
.DefiningMessagesAs(t => t.GetInterfaces().Contains(typeof(IMessage)));
Run(endpointConfiguration).GetAwaiter().GetResult();
}
示例12: AsyncMain
static async Task AsyncMain()
{
Console.Title = "Samples.AsyncPages.Server";
EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.AsyncPages.Server");
endpointConfiguration.ScaleOut()
.InstanceDiscriminator("1");
endpointConfiguration.UseSerialization<JsonSerializer>();
endpointConfiguration.EnableInstallers();
endpointConfiguration.UsePersistence<InMemoryPersistence>();
IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
try
{
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
finally
{
await endpoint.Stop();
}
}
示例13: Application_Start
protected void Application_Start()
{
#region ApplicationStart
ContainerBuilder builder = new ContainerBuilder();
// Register your MVC controllers.
builder.RegisterControllers(typeof(MvcApplication).Assembly);
// Set the dependency resolver to be Autofac.
IContainer container = builder.Build();
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.Mvc.WebApplication");
endpointConfiguration.ScaleOut()
.InstanceDiscriminator("1");
endpointConfiguration.SendFailedMessagesTo("error");
endpointConfiguration.UseSerialization<JsonSerializer>();
endpointConfiguration.UseContainer<AutofacBuilder>(c => c.ExistingLifetimeScope(container));
endpointConfiguration.UsePersistence<InMemoryPersistence>();
endpointConfiguration.EnableInstallers();
endpoint = Endpoint.Start(endpointConfiguration).GetAwaiter().GetResult();
ContainerBuilder updater = new ContainerBuilder();
updater.RegisterInstance(endpoint);
updater.Update(container);
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
AreaRegistration.RegisterAllAreas();
RegisterRoutes(RouteTable.Routes);
#endregion
}