本文整理汇总了C#中BusConfiguration.ScaleOut方法的典型用法代码示例。如果您正苦于以下问题:C# BusConfiguration.ScaleOut方法的具体用法?C# BusConfiguration.ScaleOut怎么用?C# BusConfiguration.ScaleOut使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BusConfiguration
的用法示例。
在下文中一共展示了BusConfiguration.ScaleOut方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Usage
public Usage()
{
#region ScaleOut
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.ScaleOut().UseSingleBrokerQueue();
//or
busConfiguration.ScaleOut().UseUniqueBrokerQueuePerMachine();
#endregion
}
示例2: Simple
public void Simple()
{
#region ScaleOutV5
var configuration = new BusConfiguration();
configuration.ScaleOut().UseSingleBrokerQueue();
//or
configuration.ScaleOut().UseUniqueBrokerQueuePerMachine();
#endregion
}
示例3: Main
static void Main()
{
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.EndpointName("Samples.ASB.Polymorphic.Subscriber");
busConfiguration.ScaleOut().UseSingleBrokerQueue();
busConfiguration.UseTransport<AzureServiceBusTransport>()
.ConnectionString(Environment.GetEnvironmentVariable("AzureServiceBus.ConnectionString"));
#region DisableAutoSubscripton
busConfiguration.DisableFeature<AutoSubscribe>();
#endregion
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.EnableInstallers();
busConfiguration.UsePersistence<InMemoryPersistence>();
busConfiguration.DisableFeature<SecondLevelRetries>();
using (IBus bus = Bus.Create(busConfiguration).Start())
{
#region ControledSubscriptions
bus.Subscribe<BaseEvent>();
#endregion
Console.WriteLine("Subscriber is ready to receive events");
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
}
示例4: Main
private static void Main()
{
var configuration = new BusConfiguration();
configuration.EndpointName("Samples.ASB.NativeIntegration");
configuration.ScaleOut().UseSingleBrokerQueue();
configuration.EnableInstallers();
configuration.UsePersistence<InMemoryPersistence>();
configuration.UseSerialization<JsonSerializer>();
BrokeredMessageBodyConversion.ExtractBody = brokeredMessage =>
{
using (var stream = new MemoryStream())
using (var body = brokeredMessage.GetBody<Stream>())
{
body.CopyTo(stream);
return stream.ToArray();
}
};
configuration.UseTransport<AzureServiceBusTransport>()
.ConnectionString(Environment.GetEnvironmentVariable("AzureServiceBus.ConnectionString"));
using (IBus bus = Bus.Create(configuration).Start())
{
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
}
示例5: Simple
public void Simple()
{
BusConfiguration busConfiguration = new BusConfiguration();
#region UniqueQueuePerEndpointInstance 5.2
busConfiguration.ScaleOut()
.UniqueQueuePerEndpointInstance();
#endregion
#region UniqueQueuePerEndpointInstanceWithSuffix 5.2
busConfiguration.ScaleOut()
.UniqueQueuePerEndpointInstance("-MyCustomSuffix");
#endregion
}
示例6: UniqueQueuePerEndpointInstanceWithSuffix
void UniqueQueuePerEndpointInstanceWithSuffix(BusConfiguration busConfiguration)
{
#region UniqueQueuePerEndpointInstanceWithSuffix 5.2
var scaleOutSettings = busConfiguration.ScaleOut();
scaleOutSettings.UniqueQueuePerEndpointInstance("-MyCustomSuffix");
#endregion
}
示例7: UniqueQueuePerEndpointInstance
void UniqueQueuePerEndpointInstance(BusConfiguration busConfiguration)
{
#region UniqueQueuePerEndpointInstance 5.2
var scaleOutSettings = busConfiguration.ScaleOut();
scaleOutSettings.UniqueQueuePerEndpointInstance();
#endregion
}
示例8: Main
static void Main()
{
Console.Title = "Samples.ASB.Polymorphic.Publisher";
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.EndpointName("Samples.ASB.Polymorphic.Publisher");
busConfiguration.ScaleOut().UseSingleBrokerQueue();
busConfiguration.UseTransport<AzureServiceBusTransport>()
.ConnectionString(Environment.GetEnvironmentVariable("AzureServiceBus.ConnectionString"));
busConfiguration.UsePersistence<InMemoryPersistence>();
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.EnableInstallers();
busConfiguration.DisableFeature<SecondLevelRetries>();
using (IBus bus = Bus.Create(busConfiguration).Start())
{
Console.WriteLine("Press '1' to publish the base event");
Console.WriteLine("Press '2' to publish the derived event");
Console.WriteLine("Press any other key to exit");
while (true)
{
ConsoleKeyInfo key = Console.ReadKey();
Console.WriteLine();
Guid eventId = Guid.NewGuid();
switch (key.Key)
{
case ConsoleKey.D1:
bus.Publish<BaseEvent>(e =>
{
e.EventId = eventId;
});
Console.WriteLine("BaseEvent sent. EventId: " + eventId);
break;
case ConsoleKey.D2:
bus.Publish<DerivedEvent>(e =>
{
e.EventId = eventId;
e.Data = "more data";
});
Console.WriteLine("DerivedEvent sent. EventId: " + eventId);
break;
default:
return;
}
}
}
}
示例9: ConfigureBus
/// <summary>
/// Configures the NServiceBus send only bus and registers it with the
/// container
/// </summary>
public static ISendOnlyBus ConfigureBus(IUnityContainer container)
{
var busConfiguration = new BusConfiguration();
busConfiguration.EndpointName("Tester.Sender");
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.EnableInstallers();
busConfiguration.UseTransport<AzureServiceBusTransport>().ConnectionString(ConnectionStrings.AzureServiceBus);
busConfiguration.UsePersistence<InMemoryPersistence>();
busConfiguration.ScaleOut().UseSingleBrokerQueue();
busConfiguration.UseContainer<UnityBuilder>(c => c.UseExistingContainer(UnityConfig.GetConfiguredContainer()));
busConfiguration.Conventions().DefiningEventsAs(x => x.Namespace != null && x.Namespace.StartsWith("Tester.Contracts.Events"));
return Bus.CreateSendOnly(busConfiguration);
}
示例10: StartBus
static void StartBus()
{
var config = new BusConfiguration();
config.EndpointName(EndpointName);
config.ScaleOut().UseSingleBrokerQueue();
config.UseTransport<AzureServiceBusTransport>()
.ConnectionString(settings.GetConnectionString())
.BrokeredMessageBodyInterceptors(m => m.ToBytes(), b => b.ToBrokeredMessage());
config.UseSerialization<JsonSerializer>();
config.UsePersistence<InMemoryPersistence>();
Bus.Create(config).Start();
}
示例11: CreateAmbientTxConfiguration
public static BusConfiguration CreateAmbientTxConfiguration()
{
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.EnableInstallers();
busConfiguration.ScaleOut().UseSingleBrokerQueue();
busConfiguration.EndpointName("Receiver");
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.DisableFeature<SecondLevelRetries>();
Console.WriteLine("Default Configuration");
return busConfiguration;
}
示例12: Create
public static IBus Create()
{
var config = new BusConfiguration();
config.ScaleOut().UseSingleBrokerQueue();
config.Transactions().EnableDistributedTransactions();
config.UseTransport<SqlServerTransport>();
config.UsePersistence<NHibernatePersistence, StorageType.Sagas>();
config.UsePersistence<NHibernatePersistence, StorageType.Subscriptions>();
config.UsePersistence<NHibernatePersistence, StorageType.Timeouts>();
config.UsePersistence<NHibernatePersistence, StorageType.Outbox>();
config.PurgeOnStartup(false);
config.EnableInstallers();
return Bus.Create(config);
}
示例13: Main
static void Main()
{
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.EndpointName("Samples.Azure.ServiceBus.Endpoint2");
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.EnableInstallers();
busConfiguration.ScaleOut().UseSingleBrokerQueue();
busConfiguration.UseTransport<AzureServiceBusTransport>()
.ConnectionString(Environment.GetEnvironmentVariable("SamplesAzureServiceBusConnection"));
busConfiguration.UsePersistence<InMemoryPersistence>();
using (IBus bus = Bus.Create(busConfiguration).Start())
{
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
}
示例14: GetBusConfiguration
public static BusConfiguration GetBusConfiguration()
{
var busConfiguration = new BusConfiguration();
busConfiguration.UseTransport<RabbitMQTransport>()
.DisableCallbackReceiver()
.CustomMessageIdStrategy(m => Guid.NewGuid().ToString())
.ConnectionString("host=localhost");
busConfiguration.UsePersistence<InMemoryPersistence>();
busConfiguration.Conventions()
.DefiningMessagesAs(t =>
t.Name.Equals("JObject", StringComparison.InvariantCultureIgnoreCase) ||
t.Name.Equals("SayHello", StringComparison.InvariantCultureIgnoreCase));
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.ScaleOut().UseSingleBrokerQueue();
return busConfiguration;
}
示例15: AsyncMain
static async Task AsyncMain()
{
var configuration = new BusConfiguration();
configuration.EndpointName("Minion");
configuration.ScaleOut().UniqueQueuePerEndpointInstance(ConfigurationManager.AppSettings["minion.name"]);
configuration.UseSerialization<JsonSerializer>();
configuration.UsePersistence<InMemoryPersistence>();
configuration.EnableInstallers();
configuration.SendFailedMessagesTo("error");
var endpoint = await Endpoint.Start(configuration);
ColouredConsole.WriteLine("Bello!");
Console.WriteLine("Press any key to exit");
Console.ReadLine();
await endpoint.Stop();
}