本文整理汇总了C#中BusConfiguration.Transactions方法的典型用法代码示例。如果您正苦于以下问题:C# BusConfiguration.Transactions方法的具体用法?C# BusConfiguration.Transactions怎么用?C# BusConfiguration.Transactions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BusConfiguration
的用法示例。
在下文中一共展示了BusConfiguration.Transactions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public static void Run(
int maximumNumberOfTweetsPerCatchUp,
TimeSpan defaultTransactionTimeout,
string nserviceBusConnectionString,
string endpointName,
string consumerKey,
string consumerSecret,
string accessToken,
string accessTokenSecret)
{
var busConfiguration = new BusConfiguration();
busConfiguration.Transactions().DoNotWrapHandlersExecutionInATransactionScope();
busConfiguration.Transactions().DefaultTimeout(defaultTransactionTimeout);
busConfiguration.EndpointName(endpointName);
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.EnableInstallers();
busConfiguration.UsePersistence<NHibernatePersistence>().ConnectionString(nserviceBusConnectionString);
busConfiguration.ApplyMessageConventions();
busConfiguration.RegisterComponents(c=>c.RegisterSingleton<ITweetService>(
new TweetService(maximumNumberOfTweetsPerCatchUp, consumerKey, consumerSecret, accessToken, accessTokenSecret)));
using (Bus.Create(busConfiguration).Start())
{
Console.ReadLine();
}
}
示例2: Customize
public void Customize(BusConfiguration configuration)
{
configuration.AssembliesToScan(Assembly.GetExecutingAssembly(), typeof(AxisMessage).Assembly, typeof(ReportStoreMessage).Assembly, typeof(AzureStorageQueueTransport).Assembly);
configuration.UseTransport<AzureStorageQueueTransport>();
configuration.UsePersistence<InMemoryPersistence>();
configuration.EndpointName("50000");
configuration.Transactions().DoNotWrapHandlersExecutionInATransactionScope();
configuration.Transactions().Disable();
}
示例3: AmbientTransactions
public void AmbientTransactions()
{
#region TransactionsEnable
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.Transactions().Enable().EnableDistributedTransactions();
#endregion
#region TransactionsDoNotWrapHandlersExecutionInATransactionScope
busConfiguration.Transactions().DoNotWrapHandlersExecutionInATransactionScope();
#endregion
}
示例4: TransportTransactionsWithScope
public void TransportTransactionsWithScope()
{
#region TransactionsWrapHandlersExecutionInATransactionScope
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.Transactions().DisableDistributedTransactions().WrapHandlersExecutionInATransactionScope();
#endregion
}
示例5: CustomTransactionTimeout
public void CustomTransactionTimeout()
{
#region CustomTransactionTimeout
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.Transactions().DefaultTimeout(TimeSpan.FromSeconds(30));
#endregion
}
示例6: CustomTransactionIsolationLevel
public void CustomTransactionIsolationLevel()
{
#region CustomTransactionIsolationLevel
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.Transactions().IsolationLevel(IsolationLevel.RepeatableRead);
#endregion
}
示例7: Unreliable
public void Unreliable()
{
#region TransactionsDisable
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.Transactions().Disable();
#endregion
}
示例8: 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);
}
}
示例9: Main
static void Main( string[] args )
{
var config = new BusConfiguration();
config.UsePersistence<InMemoryPersistence>();
config.UseSerialization<JsonSerializer>();
config.UseTransport<RabbitMQTransport>()
.DisableCallbackReceiver();
config.Transactions()
.DisableDistributedTransactions();
config.EnableInstallers();
config.Conventions()
.DefiningCommandsAs( t => t.Namespace != null && t.Namespace.EndsWith( ".Commands" ) )
.DefiningEventsAs( t => t.Namespace != null && t.Namespace.EndsWith( ".Events" ) )
.DefiningMessagesAs( t => t.Namespace != null && t.Namespace.EndsWith( ".Messages" ) );
using( var bus = Bus.Create( config ).Start() )
{
Logic.Run( setup =>
{
setup.DefineAction( ConsoleKey.P, "Publish sample event", () =>
{
bus.Publish<IMessagePublished>(e =>
{
e.ClientId = "client-id";
e.MessageId = "sample-message-id";
});
} );
} );
}
}
示例10: 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>();
}
示例11: 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();
//
}
示例12: StartBus
static void StartBus()
{
try
{
var myDocumentStore = new DocumentStore { ConnectionStringName = "EpiFlowDB" };
var busConfiguration = new BusConfiguration();
busConfiguration.EndpointName("EpiFlow.Messages");
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();
}
_bus = Bus.CreateSendOnly(busConfiguration);
}
catch (Exception exception)
{
OnCriticalError("Failed to start the bus.", exception);
}
}
示例13: TransportTransactions
public void TransportTransactions()
{
#region TransactionsDisableDistributedTransactions
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.Transactions().DisableDistributedTransactions();
#endregion
}
示例14: WrapHandlersExecutionInATransactionScope
public void WrapHandlersExecutionInATransactionScope()
{
#region 5to6WrapHandlersExecutionInATransactionScope
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.Transactions()
.WrapHandlersExecutionInATransactionScope();
#endregion
}
示例15: WrapHandlersExecutionInATransactionScope
void WrapHandlersExecutionInATransactionScope(BusConfiguration busConfiguration)
{
#region 5to6WrapHandlersExecutionInATransactionScope
var transactionSettings = busConfiguration.Transactions();
transactionSettings.WrapHandlersExecutionInATransactionScope();
#endregion
}