本文整理汇总了C#中BusConfiguration.UsePersistence方法的典型用法代码示例。如果您正苦于以下问题:C# BusConfiguration.UsePersistence方法的具体用法?C# BusConfiguration.UsePersistence怎么用?C# BusConfiguration.UsePersistence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BusConfiguration
的用法示例。
在下文中一共展示了BusConfiguration.UsePersistence方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
Console.Title = "Samples.Versioning.V2Publisher";
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.EndpointName("Samples.Versioning.V2Publisher");
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.UsePersistence<InMemoryPersistence>();
busConfiguration.UsePersistence<MsmqPersistence, StorageType.Subscriptions>();
busConfiguration.EnableInstallers();
using (IBus bus = Bus.Create(busConfiguration).Start())
{
Console.WriteLine("Press enter to publish a message");
Console.WriteLine("Press any key to exit");
while (true)
{
ConsoleKeyInfo key = Console.ReadKey();
Console.WriteLine();
if (key.Key != ConsoleKey.Enter)
{
return;
}
bus.Publish<V2.Messages.ISomethingHappened>(sh =>
{
sh.SomeData = 1;
sh.MoreInfo = "It's a secret.";
});
Console.WriteLine("Published event.");
}
}
}
示例2: Main
static void Main()
{
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.EndpointName("Samples.Versioning.V2Publisher");
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.UsePersistence<InMemoryPersistence>();
busConfiguration.UsePersistence<MsmqPersistence, StorageType.Subscriptions>();
busConfiguration.EnableInstallers();
using (IBus bus = Bus.Create(busConfiguration).Start())
{
Console.WriteLine("Press 'Enter' to publish a message, Ctrl + C to exit.");
while (Console.ReadLine() != null)
{
bus.Publish<V2.Messages.ISomethingHappened>(sh =>
{
sh.SomeData = 1;
sh.MoreInfo = "It's a secret.";
});
Console.WriteLine("Published event.");
}
}
}
示例3: Customize
public void Customize(BusConfiguration busConfiguration)
{
busConfiguration.UseTransport<MsmqTransport>();
busConfiguration.UsePersistence<InMemoryPersistence>();
busConfiguration.UsePersistence<MsmqPersistence, StorageType.Subscriptions>();
busConfiguration.EnableInstallers();
}
示例4: Version_5_0
void Version_5_0(BusConfiguration busConfiguration)
{
#pragma warning disable 618
#region ConfiguringNHibernate 5.0
//Use NHibernate for all persistence concerns
busConfiguration.UsePersistence<NHibernatePersistence>();
//or select specific concerns
busConfiguration.UsePersistence<NHibernatePersistence>()
.For(
Storage.Sagas,
Storage.Subscriptions,
Storage.Timeouts,
Storage.Outbox,
Storage.GatewayDeduplication);
#endregion
#region NHibernateSubscriptionCaching 5.0
var persistence = busConfiguration.UsePersistence<NHibernatePersistence>();
persistence.EnableCachingForSubscriptionStorage(TimeSpan.FromSeconds(10));
#endregion
#pragma warning restore 618
}
示例5: Usage
public void Usage()
{
BusConfiguration busConfiguration = new BusConfiguration();
#region DisableSchemaUpdate
busConfiguration.UsePersistence<NHibernatePersistence>()
.DisableSchemaUpdate();
#endregion
#region DisableGatewaySchemaUpdate
busConfiguration.UsePersistence<NHibernatePersistence>()
.DisableGatewayDeduplicationSchemaUpdate();
#endregion
#region DisableSubscriptionSchemaUpdate
busConfiguration.UsePersistence<NHibernatePersistence>()
.DisableSubscriptionStorageSchemaUpdate();
#endregion
#region DisableTimeoutSchemaUpdate
busConfiguration.UsePersistence<NHibernatePersistence>()
.DisableTimeoutStorageSchemaUpdate();
#endregion
}
示例6: Customize
public void Customize(BusConfiguration configuration)
{
configuration.UsePersistence<RavenDBPersistence>()
.DoNotSetupDatabasePermissions()
.For( Storage.Sagas, Storage.Subscriptions );
configuration.UsePersistence<InMemoryPersistence>()
.For( Storage.Timeouts );
}
示例7: Setup_5_2
void Setup_5_2(BusConfiguration busConfiguration)
{
#region PersistenceOrder_Correct 5.2
busConfiguration.UsePersistence<RavenDBPersistence>();
busConfiguration.UsePersistence<NHibernatePersistence, StorageType.Outbox>();
busConfiguration.UsePersistence<InMemoryPersistence, StorageType.GatewayDeduplication>();
#endregion
}
示例8: Version_5_2
void Version_5_2(BusConfiguration busConfiguration)
{
#region ConfiguringInMemory 5.2
busConfiguration.UsePersistence<InMemoryPersistence, StorageType.Sagas>();
busConfiguration.UsePersistence<InMemoryPersistence, StorageType.Subscriptions>();
busConfiguration.UsePersistence<InMemoryPersistence, StorageType.Timeouts>();
busConfiguration.UsePersistence<InMemoryPersistence, StorageType.Outbox>();
busConfiguration.UsePersistence<InMemoryPersistence, StorageType.GatewayDeduplication>();
#endregion
}
示例9: Setup3_5_2
void Setup3_5_2(BusConfiguration busConfiguration)
{
#region PersistenceOrder_Explicit 5.2
busConfiguration.UsePersistence<NHibernatePersistence, StorageType.Outbox>();
busConfiguration.UsePersistence<InMemoryPersistence, StorageType.GatewayDeduplication>();
busConfiguration.UsePersistence<RavenDBPersistence, StorageType.Sagas>();
busConfiguration.UsePersistence<RavenDBPersistence, StorageType.Subscriptions>();
busConfiguration.UsePersistence<RavenDBPersistence, StorageType.Timeouts>();
#endregion
}
示例10: Setup2
void Setup2()
{
#region PersistenceOrder_Incorrect
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.UsePersistence<NHibernatePersistence, StorageType.Outbox>();
busConfiguration.UsePersistence<InMemoryPersistence, StorageType.GatewayDeduplication>();
// This one will override the above settings!
busConfiguration.UsePersistence<RavenDBPersistence>();
#endregion
}
示例11: ConfiguringInMemory
public void ConfiguringInMemory()
{
#region ConfiguringInMemory
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.UsePersistence<InMemoryPersistence, StorageType.Sagas>();
busConfiguration.UsePersistence<InMemoryPersistence, StorageType.Subscriptions>();
busConfiguration.UsePersistence<InMemoryPersistence, StorageType.Timeouts>();
busConfiguration.UsePersistence<InMemoryPersistence, StorageType.Outbox>();
busConfiguration.UsePersistence<InMemoryPersistence, StorageType.GatewayDeduplication>();
#endregion
}
示例12: AsyncMain
static async Task AsyncMain()
{
#region ContainerConfiguration
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.EndpointName("Samples.Castle");
WindsorContainer container = new WindsorContainer();
container.Register(Component.For<MyService>().Instance(new MyService()));
busConfiguration.UseContainer<WindsorBuilder>(c => c.ExistingContainer(container));
#endregion
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.UsePersistence<InMemoryPersistence>();
busConfiguration.SendFailedMessagesTo("error");
busConfiguration.EnableInstallers();
IEndpointInstance endpoint = await Endpoint.Start(busConfiguration);
try
{
await endpoint.SendLocal(new MyMessage());
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
finally
{
await endpoint.Stop();
}
}
示例13: Customize
public void Customize(BusConfiguration configuration)
{
configuration.UseTransport<RabbitMQTransport>();
configuration.UsePersistence<InMemoryPersistence>();
configuration.RijndaelEncryptionService();
UnobtrusiveMessageConventions.Init(configuration.Conventions());
}
示例14: Main
static void Main()
{
Console.Title = "Samples.MongoDB.Client";
var busConfiguration = new BusConfiguration();
busConfiguration.EndpointName("Samples.MongoDB.Client");
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.EnableInstallers();
busConfiguration.UsePersistence<InMemoryPersistence>();
using (var bus = Bus.Create(busConfiguration).Start())
{
Console.WriteLine("Press 'enter' to send a StartOrder messages");
Console.WriteLine("Press any other key to exit");
while (true)
{
var key = Console.ReadKey();
Console.WriteLine();
if (key.Key != ConsoleKey.Enter)
{
return;
}
var orderId = Guid.NewGuid();
var startOrder = new StartOrder
{
OrderId = orderId
};
bus.Send("Samples.MongoDB.Server", startOrder);
Console.WriteLine($"StartOrder Message sent with OrderId {orderId}");
}
}
}
示例15: OnStart
protected override void OnStart(string[] args)
{
try
{
container = new Container(x => x.AddRegistry<DependencyRegistry>());
var myDocumentStore = new DocumentStore { ConnectionStringName = "EpiFlowDB" };
var busConfiguration = new BusConfiguration();
busConfiguration.EndpointName("EpiFlow.Messages");
busConfiguration.UseContainer<StructureMapBuilder>(c => c.ExistingContainer(container));
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.UsePersistence<RavenDBPersistence>()
.UseDocumentStoreForSubscriptions(myDocumentStore)
.UseDocumentStoreForSagas(myDocumentStore)
.UseDocumentStoreForTimeouts(myDocumentStore);
busConfiguration.UseTransport<RabbitMQTransport>();
busConfiguration.DefineCriticalErrorAction(OnCriticalError);
busConfiguration.Transactions().DisableDistributedTransactions();
if (Environment.UserInteractive && Debugger.IsAttached)
{
busConfiguration.EnableInstallers();
}
var startableBus = Bus.Create(busConfiguration);
bus = startableBus.Start();
}
catch (Exception exception)
{
OnCriticalError("Failed to start the bus.", exception);
}
}