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


C# BusConfiguration.UsePersistence方法代码示例

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

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

示例3: Customize

 public void Customize(BusConfiguration busConfiguration)
 {
     busConfiguration.UseTransport<MsmqTransport>();
     busConfiguration.UsePersistence<InMemoryPersistence>();
     busConfiguration.UsePersistence<MsmqPersistence, StorageType.Subscriptions>();
     busConfiguration.EnableInstallers();
 }
开发者ID:roycornelissen,项目名称:SignalR.NServiceBus,代码行数:7,代码来源:EndpointConfig.cs

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

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

示例6: Customize

        public void Customize(BusConfiguration configuration)
        {
            configuration.UsePersistence<RavenDBPersistence>()
                .DoNotSetupDatabasePermissions()
                .For( Storage.Sagas, Storage.Subscriptions );

            configuration.UsePersistence<InMemoryPersistence>()
                .For( Storage.Timeouts );

        }
开发者ID:modulexcite,项目名称:NServiceBus.Samples,代码行数:10,代码来源:EndpointConfig.cs

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

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

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

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

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

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

示例13: Customize

 public void Customize(BusConfiguration configuration)
 {
     configuration.UseTransport<RabbitMQTransport>();
     configuration.UsePersistence<InMemoryPersistence>();
     configuration.RijndaelEncryptionService();
     UnobtrusiveMessageConventions.Init(configuration.Conventions());
 }
开发者ID:ghola,项目名称:NServiceBus.RabbitMQ.Samples,代码行数:7,代码来源:EndpointConfig.cs

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

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


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