当前位置: 首页>>代码示例>>C#>>正文


C# BusConfiguration.Transactions方法代码示例

本文整理汇总了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();
            }
        }
开发者ID:adamralph,项目名称:HashBus,代码行数:26,代码来源:App.cs

示例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();
 }
开发者ID:jaldipp,项目名称:NServiceBus_Repro_DevStorage,代码行数:9,代码来源:EndpointConfig.cs

示例3: AmbientTransactions

        public void AmbientTransactions()
        {
            #region TransactionsEnable
            BusConfiguration busConfiguration = new BusConfiguration();
            busConfiguration.Transactions().Enable().EnableDistributedTransactions();
            #endregion

            #region TransactionsDoNotWrapHandlersExecutionInATransactionScope
            busConfiguration.Transactions().DoNotWrapHandlersExecutionInATransactionScope();
            #endregion
        }
开发者ID:RichieYang,项目名称:docs.particular.net,代码行数:11,代码来源:Transactions.cs

示例4: TransportTransactionsWithScope

 public void TransportTransactionsWithScope()
 {
     #region TransactionsWrapHandlersExecutionInATransactionScope
     BusConfiguration busConfiguration = new BusConfiguration();
     busConfiguration.Transactions().DisableDistributedTransactions().WrapHandlersExecutionInATransactionScope();
     #endregion
 }
开发者ID:RichieYang,项目名称:docs.particular.net,代码行数:7,代码来源:Transactions.cs

示例5: CustomTransactionTimeout

 public void CustomTransactionTimeout()
 {
     #region CustomTransactionTimeout
     BusConfiguration busConfiguration = new BusConfiguration();
     busConfiguration.Transactions().DefaultTimeout(TimeSpan.FromSeconds(30));
     #endregion
 }
开发者ID:RichieYang,项目名称:docs.particular.net,代码行数:7,代码来源:Transactions.cs

示例6: CustomTransactionIsolationLevel

 public void CustomTransactionIsolationLevel()
 {
     #region CustomTransactionIsolationLevel
     BusConfiguration busConfiguration = new BusConfiguration();
     busConfiguration.Transactions().IsolationLevel(IsolationLevel.RepeatableRead);
     #endregion
 }
开发者ID:RichieYang,项目名称:docs.particular.net,代码行数:7,代码来源:Transactions.cs

示例7: Unreliable

 public void Unreliable()
 {
     #region TransactionsDisable
     BusConfiguration busConfiguration = new BusConfiguration();
     busConfiguration.Transactions().Disable();
     #endregion
 }
开发者ID:RichieYang,项目名称:docs.particular.net,代码行数:7,代码来源:Transactions.cs

示例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);
            }
        }
开发者ID:wettsten,项目名称:EpiFlow,代码行数:31,代码来源:ProgramService.cs

示例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";
                        });
                    } );
                } );
            }
        }
开发者ID:khaledm,项目名称:PoweringFrontEndApps,代码行数:32,代码来源:Program.cs

示例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>();
        }
开发者ID:techvenky,项目名称:microservice-template,代码行数:31,代码来源:EndpointConfig.cs

示例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();
            //
        }
开发者ID:eraj2587,项目名称:NserviceBusDemo,代码行数:26,代码来源:EndpointConfig.cs

示例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);
            }
        }
开发者ID:wettsten,项目名称:EpiFlow,代码行数:28,代码来源:Program.cs

示例13: TransportTransactions

        public void TransportTransactions()
        {
            #region TransactionsDisableDistributedTransactions
            BusConfiguration busConfiguration = new BusConfiguration();
            busConfiguration.Transactions().DisableDistributedTransactions();
            #endregion

        }
开发者ID:RichieYang,项目名称:docs.particular.net,代码行数:8,代码来源:Transactions.cs

示例14: WrapHandlersExecutionInATransactionScope

 public void WrapHandlersExecutionInATransactionScope()
 {
     #region 5to6WrapHandlersExecutionInATransactionScope
     BusConfiguration busConfiguration = new BusConfiguration();
     busConfiguration.Transactions()
         .WrapHandlersExecutionInATransactionScope();
     #endregion
 }
开发者ID:vanwyngardenk,项目名称:docs.particular.net,代码行数:8,代码来源:Upgrade.cs

示例15: WrapHandlersExecutionInATransactionScope

        void WrapHandlersExecutionInATransactionScope(BusConfiguration busConfiguration)
        {
            #region 5to6WrapHandlersExecutionInATransactionScope

            var transactionSettings = busConfiguration.Transactions();
            transactionSettings.WrapHandlersExecutionInATransactionScope();
            #endregion
        }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:8,代码来源:Upgrade.cs


注:本文中的BusConfiguration.Transactions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。