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


C# EndpointConfiguration.DisableFeature方法代码示例

本文整理汇总了C#中EndpointConfiguration.DisableFeature方法的典型用法代码示例。如果您正苦于以下问题:C# EndpointConfiguration.DisableFeature方法的具体用法?C# EndpointConfiguration.DisableFeature怎么用?C# EndpointConfiguration.DisableFeature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EndpointConfiguration的用法示例。


在下文中一共展示了EndpointConfiguration.DisableFeature方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AsyncMain

    static async Task AsyncMain()
    {
        Console.Title = "Samples.SQLNHibernateOutbox.Receiver";
        #region NHibernate

        var hibernateConfig = new Configuration();
        hibernateConfig.DataBaseIntegration(x =>
        {
            x.ConnectionString = @"Data Source=.\SQLEXPRESS;Initial Catalog=nservicebus;Integrated Security=True";
            x.Dialect<MsSql2012Dialect>();
        });
        var mapper = new ModelMapper();
        mapper.AddMapping<OrderMap>();
        hibernateConfig.AddMapping(mapper.CompileMappingForAllExplicitlyAddedEntities());

        #endregion

        new SchemaExport(hibernateConfig).Execute(false, true, false);

        var endpointConfiguration = new EndpointConfiguration("Samples.SQLNHibernateOutbox.Receiver");
        endpointConfiguration.UseSerialization<JsonSerializer>();
        #region ReceiverConfiguration

        var transport = endpointConfiguration.UseTransport<SqlServerTransport>();
        transport.ConnectionString(@"Data Source=.\SQLEXPRESS;Initial Catalog=nservicebus;Integrated Security=True");

        var persistence = endpointConfiguration.UsePersistence<NHibernatePersistence>();
        persistence.UseConfiguration(hibernateConfig);

        endpointConfiguration.EnableOutbox();

        #endregion

        #region RetriesConfiguration

        endpointConfiguration.DisableFeature<FirstLevelRetries>();
        endpointConfiguration.DisableFeature<SecondLevelRetries>();

        #endregion

        endpointConfiguration.SendFailedMessagesTo("error");
        endpointConfiguration.AuditProcessedMessagesTo("audit");

        var endpointInstance = await Endpoint.Start(endpointConfiguration)
            .ConfigureAwait(false);
        try
        {
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
        finally
        {
            await endpointInstance.Stop()
                .ConfigureAwait(false);
        }
    }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:56,代码来源:Program.cs

示例2: AsyncMain

    static async Task AsyncMain()
    {
        Console.Title = "Samples.SQLNHibernateOutbox.Sender";
        const string letters = "ABCDEFGHIJKLMNOPQRSTUVXYZ";
        Random random = new Random();
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.SQLNHibernateOutbox.Sender");
        endpointConfiguration.UseSerialization<JsonSerializer>();

        #region SenderConfiguration

        endpointConfiguration
            .UseTransport<SqlServerTransport>()
            .ConnectionString(@"Data Source=.\SQLEXPRESS;Initial Catalog=nservicebus;Integrated Security=True");

        endpointConfiguration
            .UsePersistence<NHibernatePersistence>()
            .ConnectionString(@"Data Source=.\SQLEXPRESS;Initial Catalog=nservicebus;Integrated Security=True");
        
        endpointConfiguration.EnableOutbox();

        #endregion

        endpointConfiguration.DisableFeature<FirstLevelRetries>();
        endpointConfiguration.DisableFeature<SecondLevelRetries>();
        endpointConfiguration.SendFailedMessagesTo("error");
        endpointConfiguration.AuditProcessedMessagesTo("audit");

        IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
        try
        {
            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;
                }
                string orderId = new string(Enumerable.Range(0, 4).Select(x => letters[random.Next(letters.Length)]).ToArray());
                await endpoint.Publish(new OrderSubmitted
                {
                    OrderId = orderId,
                    Value = random.Next(100)
                });
            }
        }
        finally
        {
            await endpoint.Stop();
        }
    }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:53,代码来源:Program.cs

示例3: Start

    static async Task Start()
    {
        Console.Title = "Samples.SampleWithClean";

        #region ConfigureNLog

        ConfigurationItemFactory.Default.LayoutRenderers
            .RegisterDefinition("customexception", typeof(CustomExceptionLayoutRenderer));
        LoggingConfiguration config = new LoggingConfiguration();

        string layout = "$|${logger}|${message}${onexception:${newline}${customexception:format=tostring}}";
        ConsoleTarget consoleTarget = new ConsoleTarget
        {
            Layout = layout
        };
        config.AddTarget("console", consoleTarget);
        config.LoggingRules.Add(new LoggingRule("*", LogLevel.Info, consoleTarget));
        FileTarget fileTarget = new FileTarget
        {
            FileName = "log.txt",
            Layout = layout
        };
        config.AddTarget("file", fileTarget);
        config.LoggingRules.Add(new LoggingRule("*", LogLevel.Info, fileTarget));

        LogManager.Configuration = config;

        NServiceBus.Logging.LogManager.Use<NLogFactory>();
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.SampleWithClean");

        #endregion

        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.EnableInstallers();
        #region disable-retries
        endpointConfiguration.DisableFeature<FirstLevelRetries>();
        endpointConfiguration.DisableFeature<SecondLevelRetries>();
        endpointConfiguration.SendFailedMessagesTo("error");
        #endregion
        IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
        try
        {
            await Run(endpoint);
        }
        finally
        {
            await endpoint.Stop();
        }
    }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:50,代码来源:Program.cs

示例4: DisableFeature

 void DisableFeature()
 {
     #region DisableBestPracticeEnforcementPerEndpoint
     EndpointConfiguration configuration = new EndpointConfiguration();
     configuration.DisableFeature<BestPracticeEnforcement>();
     #endregion
 }
开发者ID:fivec,项目名称:docs.particular.net,代码行数:7,代码来源:BestPracticesConfiguration.cs

示例5: GetConfiguration

        public async Task<EndpointConfiguration> GetConfiguration(RunDescriptor runDescriptor, EndpointCustomizationConfiguration endpointConfiguration, IConfigurationSource configSource, Action<EndpointConfiguration> configurationBuilderCustomization)
        {
            var settings = runDescriptor.Settings;

            var types = endpointConfiguration.GetTypesScopedByTestClass();

            typesToInclude.AddRange(types);

            var builder = new EndpointConfiguration(endpointConfiguration.EndpointName);

            builder.TypesToIncludeInScan(typesToInclude);
            builder.CustomConfigurationSource(configSource);
            builder.EnableInstallers();

            builder.DisableFeature<TimeoutManager>();
            builder.Recoverability().Delayed(cfg => cfg.NumberOfRetries(0));
            builder.Recoverability().Immediate(cfg => cfg.NumberOfRetries(0));

            await builder.DefineTransport(settings, endpointConfiguration.EndpointName).ConfigureAwait(false);

            builder.DefineBuilder(settings);
            builder.RegisterComponentsAndInheritanceHierarchy(runDescriptor);

            Type serializerType;
            if (settings.TryGet("Serializer", out serializerType))
            {
                builder.UseSerialization((SerializationDefinition) Activator.CreateInstance(serializerType));
            }
            await builder.DefinePersistence(settings, endpointConfiguration.EndpointName).ConfigureAwait(false);

            builder.GetSettings().SetDefault("ScaleOut.UseSingleBrokerQueue", true);
            configurationBuilderCustomization(builder);

            return builder;
        }
开发者ID:Particular,项目名称:ServiceControl.Plugin.Nsb6.Heartbeat,代码行数:35,代码来源:DefaultServer.cs

示例6: GetConfiguration

        public async Task<EndpointConfiguration> GetConfiguration(RunDescriptor runDescriptor, EndpointCustomizationConfiguration endpointConfiguration, IConfigurationSource configSource, Action<EndpointConfiguration> configurationBuilderCustomization)
        {
            var settings = runDescriptor.Settings;

            var types = endpointConfiguration.GetTypesScopedByTestClass();

            typesToInclude.AddRange(types);

            var configuration = new EndpointConfiguration(endpointConfiguration.EndpointName);

            configuration.TypesToIncludeInScan(typesToInclude);
            configuration.CustomConfigurationSource(configSource);
            configuration.EnableInstallers();

            configuration.DisableFeature<TimeoutManager>();

            var recoverability = configuration.Recoverability();
            recoverability.Delayed(delayed => delayed.NumberOfRetries(0));
            recoverability.Immediate(immediate => immediate.NumberOfRetries(0));

            await configuration.DefineTransport(settings, endpointConfiguration.EndpointName).ConfigureAwait(false);

            configuration.DefineBuilder(settings);
            configuration.RegisterComponentsAndInheritanceHierarchy(runDescriptor);

            configuration.UseSerialization<WireSerializer>();
            await configuration.DefinePersistence(settings, endpointConfiguration.EndpointName).ConfigureAwait(false);

            configuration.GetSettings().SetDefault("ScaleOut.UseSingleBrokerQueue", true);
            configurationBuilderCustomization(configuration);

            return configuration;
        }
开发者ID:SimonCropp,项目名称:NServiceBus.Wire,代码行数:33,代码来源:DefaultServer.cs

示例7: AsyncMain

    static async Task AsyncMain()
    {
        Console.Title = "Samples.PubSub.Subscriber2";
        LogManager.Use<DefaultFactory>().Level(LogLevel.Info);
        var endpointConfiguration = new EndpointConfiguration("Samples.PubSub.Subscriber2");
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.DisableFeature<AutoSubscribe>();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.SendFailedMessagesTo("error");
        endpointConfiguration.EnableInstallers();

        var endpointInstance = await Endpoint.Start(endpointConfiguration)
            .ConfigureAwait(false);
        try
        {
            await endpointInstance.Subscribe<IMyEvent>()
                .ConfigureAwait(false);
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
            await endpointInstance.Unsubscribe<IMyEvent>()
                .ConfigureAwait(false);
        }
        finally
        {
            await endpointInstance.Stop()
                .ConfigureAwait(false);
        }
    }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:28,代码来源:Program.cs

示例8: AsyncMain

    static async Task AsyncMain()
    {

        #region sqlrelay-config
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration();
        endpointConfiguration.SendFailedMessagesTo("error");
        endpointConfiguration.EndpointName("SqlRelay");
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.DisableFeature<AutoSubscribe>();
        endpointConfiguration.UsePersistence<NHibernatePersistence>()
            .ConnectionString(@"Data Source=.\SQLEXPRESS;Initial Catalog=PersistenceForSqlTransport;Integrated Security=True");
        endpointConfiguration.UseTransport<SqlServerTransport>()
            .ConnectionString(@"Data Source=.\SQLEXPRESS;Initial Catalog=PersistenceForSqlTransport;Integrated Security=True");
        #endregion


        IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
        try
        {
            Console.WriteLine("\r\nSqlRelay is running - This endpoint will relay all events received to subscribers. Press any key to stop program\r\n");
            Console.ReadKey();
        }
        finally
        {
            await endpoint.Stop();
        }
    }
开发者ID:fivec,项目名称:docs.particular.net,代码行数:27,代码来源:Program.cs

示例9: AsyncMain

    static async Task AsyncMain()
    {
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration();
        endpointConfiguration.EndpointName("Samples.CustomTransport.Endpoint1");
#region UseDefinition
        endpointConfiguration.UseTransport<FileTransport>();
#endregion
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.SendFailedMessagesTo("error");
        endpointConfiguration.DisableFeature<TimeoutManager>();

        IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
        try
        {
            #region StartMessageInteraction
            await endpoint.Send("Samples.CustomTransport.Endpoint2", new MessageA());
            #endregion
            Console.WriteLine("MessageA sent. Press any key to exit");
            Console.ReadKey();
        }
        finally
        {
            await endpoint.Stop();
        }
    }
开发者ID:fivec,项目名称:docs.particular.net,代码行数:26,代码来源:Program.cs

示例10: GetConfiguration

        public Task<EndpointConfiguration> GetConfiguration(RunDescriptor runDescriptor, EndpointCustomizationConfiguration endpointConfiguration, IConfigurationSource configSource, Action<EndpointConfiguration> configurationBuilderCustomization)
        {
            var types = GetTypesScopedByTestClass(endpointConfiguration);

            typesToInclude.AddRange(types);

            var builder = new EndpointConfiguration(endpointConfiguration.EndpointName);

            builder.TypesToIncludeInScan(typesToInclude);
            builder.CustomConfigurationSource(configSource);
            builder.EnableInstallers();

            builder.DisableFeature<TimeoutManager>();
            builder.Recoverability()
                .Delayed(delayed => delayed.NumberOfRetries(0))
                .Immediate(immediate => immediate.NumberOfRetries(0));

            builder.RegisterComponents(r => { RegisterInheritanceHierarchyOfContextOnContainer(runDescriptor, r); });

            builder.UsePersistence<InMemoryPersistence>();

            configurationBuilderCustomization(builder);

            return Task.FromResult(builder);
        }
开发者ID:Particular,项目名称:NServiceBus,代码行数:25,代码来源:DefaultServer.cs

示例11: GetConfiguration

        public async Task<EndpointConfiguration> GetConfiguration(RunDescriptor runDescriptor, EndpointCustomizationConfiguration endpointConfiguration, IConfigurationSource configSource, Action<EndpointConfiguration> configurationBuilderCustomization)
        {
            var settings = runDescriptor.Settings;

            var types = endpointConfiguration.GetTypesScopedByTestClass();

            typesToInclude.AddRange(types);

            var builder = new EndpointConfiguration(endpointConfiguration.EndpointName);
            builder.TypesToIncludeInScan(typesToInclude);
            builder.CustomConfigurationSource(configSource);
            builder.EnableInstallers();

            builder.DisableFeature<TimeoutManager>();
            builder.Recoverability()
                .Delayed(delayed => delayed.NumberOfRetries(0))
                .Immediate(immediate => immediate.NumberOfRetries(0));

            await builder.DefineTransport(settings, endpointConfiguration.EndpointName).ConfigureAwait(false);

            builder.RegisterComponentsAndInheritanceHierarchy(runDescriptor);

            configurationBuilderCustomization(builder);

            return builder;
        }
开发者ID:areicher,项目名称:NServiceBus.RavenDB,代码行数:26,代码来源:ServerWithNoDefaultPersistenceDefinitions.cs

示例12: DisableWithCode

        DisableWithCode(EndpointConfiguration endpointConfiguration)
        {
            #region DisableSlrWithCode
            endpointConfiguration.DisableFeature<SecondLevelRetries>();

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

示例13: MainAsync

    static async Task MainAsync()
    {
        Console.Title = "Samples.ASB.Polymorphic.Publisher";
        var endpointConfiguration = new EndpointConfiguration("Samples.ASB.Polymorphic.Publisher");
        var transport = endpointConfiguration.UseTransport<AzureServiceBusTransport>();
        transport.UseTopology<EndpointOrientedTopology>();
        transport.ConnectionString(Environment.GetEnvironmentVariable("AzureServiceBus.ConnectionString"));
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.SendFailedMessagesTo("error");
        endpointConfiguration.DisableFeature<SecondLevelRetries>();

        IEndpointInstance endpointInstance = await Endpoint.Start(endpointConfiguration)
            .ConfigureAwait(false);

        try
        {
            Console.WriteLine("Press '1' to publish the base event");
            Console.WriteLine("Press '2' to publish the derived event");
            Console.WriteLine("Press any other key to exit");

            while (true)
            {
                ConsoleKeyInfo key = Console.ReadKey();
                Console.WriteLine();

                Guid eventId = Guid.NewGuid();

                switch (key.Key)
                {
                    case ConsoleKey.D1:
                        await endpointInstance.Publish<BaseEvent>(e =>
                        {
                            e.EventId = eventId;
                        });
                        Console.WriteLine("BaseEvent sent. EventId: " + eventId);
                        break;

                    case ConsoleKey.D2:
                        await endpointInstance.Publish<DerivedEvent>(e =>
                        {
                            e.EventId = eventId;
                            e.Data = "more data";
                        });
                        Console.WriteLine("DerivedEvent sent. EventId: " + eventId);
                        break;

                    default:
                        return;
                }
            }

        }
        finally
        {
            await endpointInstance.Stop();
        }
    }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:59,代码来源:Program.cs

示例14: DisableAutoSubscribe

        void DisableAutoSubscribe(EndpointConfiguration endpointConfiguration)
        {
            #region DisableAutoSubscribe

            endpointConfiguration.DisableFeature<AutoSubscribe>();

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

示例15: DisableWithCode

        public DisableWithCode()
        {
            #region DisableSlrWithCode

            EndpointConfiguration configuration = new EndpointConfiguration();
            configuration.DisableFeature<SecondLevelRetries>();

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


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