本文整理汇总了C#中BusConfiguration.DisableFeature方法的典型用法代码示例。如果您正苦于以下问题:C# BusConfiguration.DisableFeature方法的具体用法?C# BusConfiguration.DisableFeature怎么用?C# BusConfiguration.DisableFeature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BusConfiguration
的用法示例。
在下文中一共展示了BusConfiguration.DisableFeature方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitServiceBus
private void InitServiceBus(BusConfiguration config, IContainer container)
{
// Configure Logging
NServiceBus.Logging.LogManager.Use<Log4NetFactory>();
// Configure container
config.UseContainer<StructureMapBuilder>(c => c.ExistingContainer(container));
// Xml serialization makes for easy to read messages.
config.UseSerialization<JsonSerializer>();
//Define conventions
ConventionsBuilder conventions = config.Conventions();
conventions.DefiningCommandsAs(MessageTypeConventions.EndsWith("Command"));
conventions.DefiningEventsAs(MessageTypeConventions.EndsWith("Event"));
conventions.DefiningMessagesAs(MessageTypeConventions.EndsWith("Message"));
// Keep it simple by default
config.DisableFeature<SecondLevelRetries>();
config.DisableFeature<AutoSubscribe>();
config.DisableFeature<TimeoutManager>();
config.DisableFeature<DataBus>();
// Configure for MSMQ
config.UseTransport<MsmqTransport>();
config.Transactions().Enable();
config.PurgeOnStartup(false);
// Configure Saga Persistence
config.UsePersistence<InMemoryPersistence>();
}
示例2: Main
static void Main()
{
var builder = new ContainerBuilder();
builder.RegisterType<Program>();
var container = builder.Build();
var configuration = new BusConfiguration();
configuration.UseContainer<AutofacBuilder>(c => c.ExistingLifetimeScope(container));
configuration.UseTransport<AzureStorageQueueTransport>()
.ConnectionString("UseDevelopmentStorage=true");
configuration.UsePersistence<AzureStoragePersistence>();
configuration.UseSerialization<JsonSerializer>();
configuration.DisableFeature<Sagas>();
configuration.DisableFeature<TimeoutManager>();
configuration.Conventions().DefiningCommandsAs(t => t.Namespace != null && t.Namespace.StartsWith("NServiceBusDemo.Messages.Commands"));
configuration.Conventions().DefiningEventsAs(t => t.Namespace != null && t.Namespace.StartsWith("NServiceBusDemo.Messages.Events"));
configuration.Conventions().DefiningMessagesAs(t => t.Namespace != null && t.Namespace.StartsWith("NServiceBusDemo.Messages.Responses"));
Bus.Create(configuration).Start();
using (var scope = container.BeginLifetimeScope())
{
scope.Resolve<Program>().Run();
}
}
示例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: Customize
public void Customize(BusConfiguration config)
{
config.DisableFeature<TimeoutManager>();
config.DisableFeature<SecondLevelRetries>();
config.DisableFeature<Sagas>();
}
示例5: Host
public static void Host(TextWriter log, CancellationToken cancellationToken)
{
var defaultFactory = LogManager.Use<DefaultFactory>();
defaultFactory.Level(LogLevel.Info);
var configuration = new BusConfiguration();
configuration.EndpointName("APIComparer.Backend");
configuration.DisableFeature<SecondLevelRetries>();
configuration.DisableFeature<Sagas>();
configuration.DisableFeature<TimeoutManager>();
configuration.UseTransport<AzureStorageQueueTransport>()
.ConnectionString(AzureEnvironment.GetConnectionString);
configuration.UsePersistence<AzureStoragePersistence>();
configuration.EnableInstallers();
using (Bus.Create(configuration).Start())
{
log.WriteLine("APIComparer.Backend - bus started");
cancellationToken.WaitHandle.WaitOne();
}
log.WriteLine("APIComparer.Backend cancelled at " + DateTimeOffset.UtcNow);
}
示例6: Application_Start
protected void Application_Start(object sender, EventArgs e)
{
var configuration = new BusConfiguration();
configuration.DisableFeature<CriticalTimeMonitoring>();
configuration.DisableFeature<SLAMonitoring>();
configuration.LoadMessageHandlers<First<UserAuthenticatedHandler>>();
configuration.UsePersistence<InMemoryPersistence>();
Bus = NServiceBus.Bus.Create(configuration).Start();
}
示例7: AsAClientEquivalent
public AsAClientEquivalent()
{
#region AsAClientEquivalent
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.PurgeOnStartup(true);
busConfiguration.Transactions().Disable();
busConfiguration.DisableFeature<SecondLevelRetries>();
busConfiguration.DisableFeature<StorageDrivenPublishing>();
busConfiguration.DisableFeature<TimeoutManager>();
#endregion
}
示例8: AsyncMain
static async Task AsyncMain()
{
LogManager.Use<DefaultFactory>().Level(LogLevel.Info);
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.EndpointName("Samples.PubSub.Subscriber2");
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.DisableFeature<AutoSubscribe>();
busConfiguration.UsePersistence<InMemoryPersistence>();
busConfiguration.SendFailedMessagesTo("error");
busConfiguration.EnableInstallers();
IEndpointInstance endpoint = await Endpoint.Start(busConfiguration);
try
{
IBusSession busSession = endpoint.CreateBusSession();
await busSession.Subscribe<IMyEvent>();
Console.WriteLine("Press any key to exit");
Console.ReadKey();
await busSession.Unsubscribe<IMyEvent>();
}
finally
{
await endpoint.Stop();
}
}
示例9: Main
static void Main()
{
Console.Title = "Samples.SqlServer.StoreAndForwardReceiver";
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.EndpointName("Samples.SqlServer.StoreAndForwardReceiver");
#region ReceiverConfiguration
busConfiguration.UseTransport<SqlServerTransport>()
.UseSpecificConnectionInformation(
EndpointConnectionInfo.For("Samples.SqlServer.StoreAndForwardSender")
.UseConnectionString(@"Data Source=.\SQLEXPRESS;Initial Catalog=sender;Integrated Security=True"));
busConfiguration.UsePersistence<NHibernatePersistence>();
#endregion
busConfiguration.DisableFeature<SecondLevelRetries>();
using (Bus.Create(busConfiguration).Start())
{
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
}
示例10: AsyncMain
static async Task AsyncMain()
{
LogManager.Use<DefaultFactory>()
.Level(LogLevel.Warn);
#region DisableSLR
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.EndpointName("Samples.ErrorHandling.WithoutSLR");
busConfiguration.DisableFeature<SecondLevelRetries>();
#endregion
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.UsePersistence<InMemoryPersistence>();
busConfiguration.EnableInstallers();
busConfiguration.SendFailedMessagesTo("error");
using (IBus bus = await Bus.Create(busConfiguration).StartAsync())
{
Console.WriteLine("Press enter to send a message that will throw an exception.");
Console.WriteLine("Press any key to exit");
while (true)
{
ConsoleKeyInfo key = Console.ReadKey();
if (key.Key != ConsoleKey.Enter)
{
return;
}
MyMessage m = new MyMessage
{
Id = Guid.NewGuid()
};
await bus.SendLocalAsync(m);
}
}
}
示例11: Customize
public void Customize(BusConfiguration configuration)
{
configuration.UsePersistence<DatabaseRoutingInMemoryPersistence>();
configuration.DisableFeature<AutoSubscribe>();
configuration.Pipeline.Register<DatabaseRouting.DatabaseRoutingStepInPipeline>();
configuration.CustomConfigurationSource(new DatabaseRoutingConfiguration());
}
示例12: Main
static void Main()
{
LogManager.Use<DefaultFactory>()
.Level(LogLevel.Warn);
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.EndpointName("Samples.ErrorHandling.WithoutSLR");
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.UsePersistence<InMemoryPersistence>();
busConfiguration.DisableFeature<SecondLevelRetries>();
busConfiguration.EnableInstallers();
using (IBus bus = Bus.Create(busConfiguration).Start())
{
Console.WriteLine("Press any key to send a message that will throw an exception.");
Console.WriteLine("To exit, press Ctrl + C");
while (true)
{
Console.ReadLine();
MyMessage m = new MyMessage
{
Id = Guid.NewGuid()
};
bus.SendLocal(m);
}
}
}
示例13: DisableFeature
void DisableFeature()
{
#region DisableBestPracticeEnforcementPerEndpoint
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.DisableFeature<BestPracticeEnforcement>();
#endregion
}
示例14: DisableAutoSubscribe
void DisableAutoSubscribe(BusConfiguration busConfiguration)
{
#region DisableAutoSubscribe
busConfiguration.DisableFeature<AutoSubscribe>();
#endregion
}
示例15: DisableWithCode
DisableWithCode(BusConfiguration busConfiguration)
{
#region DisableSlrWithCode
busConfiguration.DisableFeature<SecondLevelRetries>();
#endregion
}