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


C# BusConfiguration.EnableOutbox方法代码示例

本文整理汇总了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();
        }
    }
开发者ID:ryanrdl,项目名称:docs.particular.net,代码行数:25,代码来源:Program.cs

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

示例3: Usage

        Usage(BusConfiguration busConfiguration)
        {
            #region OutboxEnablineInCode

            busConfiguration.EnableOutbox();

            #endregion
        }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:8,代码来源:Usage.cs

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

示例5: Usage

        public Usage()
        {
            #region OutboxEnablineInCode

            BusConfiguration busConfiguration = new BusConfiguration();

            busConfiguration.EnableOutbox();

            #endregion
        }
开发者ID:cdnico,项目名称:docs.particular.net,代码行数:10,代码来源:Usage.cs

示例6: Outbox

        public void Outbox()
        {

            #region TransactionsOutbox

            BusConfiguration busConfiguration = new BusConfiguration();
            busConfiguration.EnableOutbox(); //Implies .DisableDistributedTransactions().DoNotWrapHandlersExecutionInATransactionScope();

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

示例7: Simple

    public void Simple()
    {
        #region OutboxEnablineInFluent

        var configuration = new BusConfiguration();

        configuration.EnableOutbox();

        #endregion
    }
开发者ID:KrzysztofKielce,项目名称:docs.particular.net,代码行数:10,代码来源:OutboxEnableInFluent.cs

示例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();
            }
        }
开发者ID:MyDealerLot,项目名称:NServiceBus.RabbitMQ,代码行数:16,代码来源:RabbitMqTransport.cs

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

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

示例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();
        }
开发者ID:james-wu,项目名称:Continuum,代码行数:20,代码来源:BusBootstrapper.cs

示例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();
        }
    }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:43,代码来源:Program.cs

示例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();
			}
		}
开发者ID:GCMGrosvenor,项目名称:NServiceBus.AmazonSQS-1,代码行数:19,代码来源:SqsTransport.cs

示例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();
        }
    }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:42,代码来源:Program.cs

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


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