本文整理汇总了C#中BusConfiguration.EnableOutbox方法的典型用法代码示例。如果您正苦于以下问题:C# BusConfiguration.EnableOutbox方法的具体用法?C# BusConfiguration.EnableOutbox怎么用?C# BusConfiguration.EnableOutbox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BusConfiguration
的用法示例。
在下文中一共展示了BusConfiguration.EnableOutbox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
using (ReceiverDataContext ctx = new ReceiverDataContext())
{
ctx.Database.Initialize(true);
}
#region ReceiverConfiguration
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.UseTransport<SqlServerTransport>().UseSpecificConnectionInformation(
EndpointConnectionInfo.For("sender")
.UseConnectionString(@"Data Source=.\SQLEXPRESS;Initial Catalog=sender;Integrated Security=True"));
busConfiguration.UsePersistence<NHibernatePersistence>().RegisterManagedSessionInTheContainer();
busConfiguration.EnableOutbox();
#endregion
using (Bus.Create(busConfiguration).Start())
{
Console.WriteLine("Press <enter> to exit");
Console.ReadLine();
}
}
示例2: Customize
public void Customize(BusConfiguration configuration)
{
XmlConfigurator.Configure();
configuration.UseContainer<NinjectBuilder>(k => k.ExistingKernel(CreateKernel()));
configuration.RegisterComponents(x => x.ConfigureComponent<IRepository>(
builder =>
{
return new Repository(() =>
{
var nh = builder.Build<NHibernateStorageContext>();
var e = new OrderContext((DbConnection)nh.Connection);
return e;
});
},
DependencyLifecycle.InstancePerUnitOfWork));
configuration.RegisterComponents(components => components.ConfigureComponent<UnitOfWork>(DependencyLifecycle.InstancePerUnitOfWork));
configuration.UsePersistence<NHibernatePersistence>();
configuration.UseTransport<MsmqTransport>();
configuration.UseDataBus<FileShareDataBus>().BasePath(Constants.NServiceBus_DataBusBasePath);
configuration.RijndaelEncryptionService();
configuration.Transactions();
configuration.EnableOutbox();
configuration.Conventions().OrderConventions();
//
}
示例3: Usage
Usage(BusConfiguration busConfiguration)
{
#region OutboxEnablineInCode
busConfiguration.EnableOutbox();
#endregion
}
示例4: Main
static void Main()
{
Console.Title = "Samples.SQLNHibernateOutboxEF.Sender";
const string letters = "ABCDEFGHIJKLMNOPQRSTUVXYZ";
var random = new Random();
var hibernateConfig = new Configuration();
hibernateConfig.DataBaseIntegration(x =>
{
x.ConnectionStringName = "NServiceBus/Persistence";
x.Dialect<MsSql2012Dialect>();
});
hibernateConfig.SetProperty("default_schema", "sender");
var busConfiguration = new BusConfiguration();
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.EndpointName("Samples.SQLNHibernateOutboxEF.Sender");
#region SenderConfiguration
var transport = busConfiguration.UseTransport<SqlServerTransport>();
transport.UseSpecificConnectionInformation(
EndpointConnectionInfo.For("Samples.SQLNHibernateOutboxEF.Receiver").UseSchema("receiver"));
transport.DefaultSchema("sender");
busConfiguration.UsePersistence<NHibernatePersistence>();
busConfiguration.EnableOutbox();
#endregion
using (var bus = Bus.Create(busConfiguration).Start())
{
Console.WriteLine("Press enter to send a message");
Console.WriteLine("Press any key to exit");
while (true)
{
var key = Console.ReadKey();
Console.WriteLine();
if (key.Key != ConsoleKey.Enter)
{
return;
}
var orderId = new string(Enumerable.Range(0, 4).Select(x => letters[random.Next(letters.Length)]).ToArray());
var orderSubmitted = new OrderSubmitted
{
OrderId = orderId,
Value = random.Next(100)
};
bus.Publish(orderSubmitted);
}
}
}
示例5: Usage
public Usage()
{
#region OutboxEnablineInCode
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.EnableOutbox();
#endregion
}
示例6: Outbox
public void Outbox()
{
#region TransactionsOutbox
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.EnableOutbox(); //Implies .DisableDistributedTransactions().DoNotWrapHandlersExecutionInATransactionScope();
#endregion
}
示例7: Simple
public void Simple()
{
#region OutboxEnablineInFluent
var configuration = new BusConfiguration();
configuration.EnableOutbox();
#endregion
}
示例8: Configure
/// <summary>
/// Gives implementations access to the <see cref="T:NServiceBus.BusConfiguration"/> instance at configuration time.
/// </summary>
protected override void Configure(BusConfiguration config)
{
config.EnableFeature<RabbitMqTransportFeature>();
config.EnableFeature<TimeoutManagerBasedDeferral>();
config.GetSettings().EnableFeatureByDefault<TimeoutManager>();
//enable the outbox unless the users hasn't disabled it
if (config.GetSettings().GetOrDefault<bool>(typeof(Features.Outbox).FullName))
{
config.EnableOutbox();
}
}
示例9: Customize
public void Customize(BusConfiguration configuration)
{
configuration.RegisterComponents(c => c.ConfigureComponent<NServiceBusUnitOfWork>(DependencyLifecycle.InstancePerUnitOfWork));
configuration.RegisterComponents(c => c.ConfigureComponent<Repository>(DependencyLifecycle.InstancePerUnitOfWork));
configuration.UseContainer<NinjectBuilder>(k => k.ExistingKernel(CreateKernel()));
configuration.UsePersistence<NHibernatePersistence>();
configuration.UseTransport<MsmqTransport>();
configuration.RijndaelEncryptionService();
configuration.FileShareDataBus("NServiceBus.DataBus.BasePath");
configuration.Transactions();
configuration.EnableOutbox();
configuration.Conventions().ModuleConventions();
}
示例10: Main
static void Main()
{
LogManager.Use<DefaultFactory>().Level(LogLevel.Info);
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.EndpointName("Samples.PubSub.Subscriber1");
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.UsePersistence<InMemoryPersistence>();
busConfiguration.EnableInstallers();
busConfiguration.EnableOutbox();
using (Bus.Create(busConfiguration).Start())
{
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
}
示例11: InitialisedBus
/// <summary>
/// Initialise <see cref="IBus"/>
/// </summary>
/// <returns>Returns an instance of <see cref="IBus"/></returns>
private static IBus InitialisedBus()
{
// Setup NServiceBus
var configuration = new BusConfiguration();
configuration.UseContainer<StructureMapBuilder>();
configuration.UseSerialization<JsonSerializer>();
configuration.UseTransport<SqlServerTransport>()
.DefaultSchema("NServiceBus");
configuration.UsePersistence<NHibernatePersistence>();
configuration.EnableInstallers();
configuration.EnableOutbox();
var startableBus = Bus.Create(configuration);
return startableBus.Start();
}
示例12: Main
static void Main()
{
Console.Title = "Samples.SQLNHibernateOutboxEF.Receiver";
using (ReceiverDataContext ctx = new ReceiverDataContext())
{
ctx.Database.Initialize(true);
}
Configuration hibernateConfig = new Configuration();
hibernateConfig.DataBaseIntegration(x =>
{
x.ConnectionStringName = "NServiceBus/Persistence";
x.Dialect<MsSql2012Dialect>();
});
hibernateConfig.SetProperty("default_schema", "receiver");
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.EndpointName("Samples.SQLNHibernateOutboxEF.Receiver");
#region ReceiverConfiguration
busConfiguration
.UseTransport<SqlServerTransport>()
.UseSpecificConnectionInformation(
EndpointConnectionInfo.For("Samples.SQLNHibernateOutboxEF.Sender").UseSchema("sender"))
.DefaultSchema("receiver");
busConfiguration
.UsePersistence<NHibernatePersistence>()
.RegisterManagedSessionInTheContainer();
busConfiguration.EnableOutbox();
#endregion
using (Bus.Create(busConfiguration).Start())
{
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
}
示例13: Configure
protected override void Configure(BusConfiguration config)
{
config.EnableFeature<SqsTransportFeature>();
config.EnableFeature<MessageDrivenSubscriptions>();
if (!config.GetSettings().UseSqsDeferral())
{
config.EnableFeature<TimeoutManagerBasedDeferral>();
config.GetSettings().EnableFeatureByDefault<TimeoutManager>();
}
config.GetSettings().EnableFeatureByDefault<StorageDrivenPublishing>();
//enable the outbox unless the users hasn't disabled it
if (config.GetSettings().GetOrDefault<bool>(typeof(Features.Outbox).FullName))
{
config.EnableOutbox();
}
}
示例14: Main
static void Main()
{
Console.Title = "Samples.SQLNHibernateOutbox.Receiver";
#region NHibernate
Configuration hibernateConfig = new Configuration();
hibernateConfig.DataBaseIntegration(x =>
{
x.ConnectionStringName = "NServiceBus/Persistence";
x.Dialect<MsSql2012Dialect>();
});
ModelMapper mapper = new ModelMapper();
mapper.AddMapping<OrderMap>();
hibernateConfig.AddMapping(mapper.CompileMappingForAllExplicitlyAddedEntities());
#endregion
new SchemaExport(hibernateConfig).Execute(false, true, false);
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.EndpointName("Samples.SQLNHibernateOutbox.Receiver");
#region ReceiverConfiguration
busConfiguration.UseTransport<SqlServerTransport>();
busConfiguration.UsePersistence<NHibernatePersistence>()
.RegisterManagedSessionInTheContainer()
.UseConfiguration(hibernateConfig);
busConfiguration.EnableOutbox();
#endregion
busConfiguration.DisableFeature<SecondLevelRetries>();
using (Bus.Create(busConfiguration).Start())
{
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
}
示例15: Customize
public void Customize(BusConfiguration configuration)
{
Log.Info("Customize...");
configuration.EndpointName("orders");
configuration.UseSerialization<JsonSerializer>();
//configuration.DisableFeature<SecondLevelRetries>();
//configuration.DisableFeature<TimeoutManager>();
configuration.UseContainer<AutofacBuilder>(c => c.ExistingLifetimeScope(Container));
configuration.UseTransport<MsmqTransport>();
configuration.UsePersistence<NHibernatePersistence>();
configuration.EnableOutbox();
ConventionsBuilder conventions = configuration.Conventions();
conventions.DefiningCommandsAs(t => t.Namespace != null && t.Namespace == "Orders.Messages.Commands");
conventions.DefiningEventsAs(t => t.Namespace != null && (t.Namespace == "Orders.Messages.Events" || t.Namespace == "Orders.Messages.EventDocuments"));
//RegisterMappings.Init();
configuration.EnableInstallers();
}