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


C# EndpointConfiguration类代码示例

本文整理汇总了C#中EndpointConfiguration的典型用法代码示例。如果您正苦于以下问题:C# EndpointConfiguration类的具体用法?C# EndpointConfiguration怎么用?C# EndpointConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: 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

示例2: AsyncMain

    static async Task AsyncMain()
    {
        AggregateCatalog catalog = new AggregateCatalog();
        catalog.Catalogs.Add(new DirectoryCatalog("."));

        CompositionContainer compositionContainer = new CompositionContainer(catalog);

        Console.Title = "Samples.MefExtensionEndpoint";
        LogManager.Use<DefaultFactory>().Level(LogLevel.Info);
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.MefExtensionEndpoint");
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.EnableInstallers();
        await RunCustomizeConfiguration(compositionContainer, endpointConfiguration);
        await RunBeforeEndpointStart(compositionContainer);
        IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
        await RunAfterEndpointStart(compositionContainer, endpoint);
        try
        {
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
        finally
        {
            await RunBeforeEndpointStop(compositionContainer, endpoint);
            await endpoint.Stop();
        }
        await RunAfterEndpointStop(compositionContainer);
    }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:28,代码来源:Program.cs

示例3: Subscribe

 public static void Subscribe(EndpointConfiguration endpointConfiguration)
 {
     ErrorsNotifications errors = endpointConfiguration.Notifications.Errors;
     errors.MessageHasBeenSentToSecondLevelRetries += (sender, retry) => Log(retry);
     errors.MessageHasFailedAFirstLevelRetryAttempt += (sender, retry) => Log(retry);
     errors.MessageSentToErrorQueue += (sender, retry) => Log(retry);
 }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:7,代码来源:SubscribeToNotifications.cs

示例4: 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

示例5: Usage

        Usage(EndpointConfiguration endpointConfiguration)
        {
            #region UsingMessageBodyEncryptor
            endpointConfiguration.RegisterComponents(c => c.ConfigureComponent<MessageEncryptor>(DependencyLifecycle.InstancePerCall));

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

示例6: Application_Start

    protected void Application_Start()
    {
        #region ApplicationStart

        ContainerBuilder builder = new ContainerBuilder();

        // Register MVC controllers.
        builder.RegisterControllers(typeof(MvcApplication).Assembly);

        // Set the dependency resolver to be Autofac.
        IContainer container = builder.Build();

        EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.MvcInjection.WebApplication");
        // instruct NServiceBus to use a custom AutoFac configuration
        endpointConfiguration.UseContainer<AutofacBuilder>(c => c.ExistingLifetimeScope(container));
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.SendFailedMessagesTo("error");

        endpoint = Endpoint.Start(endpointConfiguration).GetAwaiter().GetResult();

        ContainerBuilder updater = new ContainerBuilder();
        updater.RegisterInstance(endpoint);
        updater.Update(container);

        DependencyResolver.SetResolver(new AutofacDependencyResolver(container));

        AreaRegistration.RegisterAllAreas();
        RegisterRoutes(RouteTable.Routes);

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

示例7: Customize

 public void Customize(EndpointConfiguration endpointConfiguration)
 {
     endpointConfiguration.UseSerialization<JsonSerializer>();
     endpointConfiguration.EnableInstallers();
     endpointConfiguration.SendFailedMessagesTo("error");
     endpointConfiguration.UsePersistence<InMemoryPersistence>();
 }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:7,代码来源:EndpointConfig.cs

示例8: AsyncMain

    static async Task AsyncMain()
    {
        Console.Title = "Samples.StructureMap";
        #region ContainerConfiguration
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.StructureMap");
        Container container = new Container(x => x.For<MyService>().Use(new MyService()));
        endpointConfiguration.UseContainer<StructureMapBuilder>(c => c.ExistingContainer(container));
        #endregion
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.SendFailedMessagesTo("error");

        IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
        try
        {
            await endpoint.SendLocal(new MyMessage());
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();

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

示例9: MapPublishers

 void MapPublishers(EndpointConfiguration endpointConfiguration)
 {
     #region PubSub-CodePublisherMapping
     endpointConfiguration.UnicastRouting().AddPublisher("Sales", typeof(MyEvent));
     endpointConfiguration.UnicastRouting().AddPublisher("Sales", typeof(OtherEvent).Assembly);
     #endregion
 }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:7,代码来源:PublisherMapping.cs

示例10: AsyncMain

    static async Task AsyncMain()
    {
        LogManager.Use<DefaultFactory>().Level(LogLevel.Error);
        #region Program
        Logger.WriteLine("Starting configuration");
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration();
        endpointConfiguration.EndpointName("Samples.StartupShutdown");
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.EnableFeature<MyFeature>();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.SendFailedMessagesTo("error");

        Logger.WriteLine("Calling Bus.Create");
        IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
        try
        {
            //simulate some bus activity
            Thread.Sleep(500);

            Logger.WriteLine("Bus is processing messages");
        }
        finally
        {
            Logger.WriteLine("Calling IEndpointInstance.Stop");
            await endpoint.Stop();
        }
        Logger.WriteLine("Finished");
        #endregion
        Console.WriteLine("Press any key to exit");
        Console.ReadKey();
    }
开发者ID:fivec,项目名称:docs.particular.net,代码行数:31,代码来源:Program.cs

示例11: AsyncMain

    static async Task AsyncMain()
    {
        EndpointConfiguration busConfiguration = new EndpointConfiguration();
        busConfiguration.EndpointName("Samples.ComplexSagaFindingLogic");
        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.EnableInstallers();
        busConfiguration.UsePersistence<InMemoryPersistence>();
        busConfiguration.SendFailedMessagesTo("error");

        IEndpointInstance endpoint = await Endpoint.Start(busConfiguration);
        try
        {
            await endpoint.SendLocal(new StartOrder
                          {
                              OrderId = "123"
                          });
            await endpoint.SendLocal(new StartOrder
                          {
                              OrderId = "456"
                          });
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
        finally
        {
            await endpoint.Stop();
        }
    }
开发者ID:fivec,项目名称:docs.particular.net,代码行数:28,代码来源:Program.cs

示例12: AsyncMain

    static async Task AsyncMain()
    {
        Console.Title = "Samples.StartupShutdown";
        LogManager.Use<DefaultFactory>().Level(LogLevel.Error);
        #region Program
        Logger.WriteLine("Starting configuration");
        var endpointConfiguration = new EndpointConfiguration("Samples.StartupShutdown");
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.EnableFeature<MyFeature>();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.SendFailedMessagesTo("error");

        Logger.WriteLine("Calling Endpoint.Start");
        var endpointInstance = await Endpoint.Start(endpointConfiguration)
            .ConfigureAwait(false);
        try
        {
            //simulate some activity
            await Task.Delay(500)
                .ConfigureAwait(false);

            Logger.WriteLine("Endpoint is processing messages");
        }
        finally
        {
            Logger.WriteLine("Calling IEndpointInstance.Stop");
            await endpointInstance.Stop()
                .ConfigureAwait(false);
        }
        Logger.WriteLine("Finished");
        #endregion
        Console.WriteLine($"Logged information to {Logger.OutputFilePath}");
        Console.WriteLine("Press any key to exit");
        Console.ReadKey();
    }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:35,代码来源:Program.cs

示例13: AsyncMain

    static async Task AsyncMain()
    {
        Console.Title = "Samples.Unity";
        #region ContainerConfiguration
        var endpointConfiguration = new EndpointConfiguration("Samples.Unity");
        var container = new UnityContainer();
        container.RegisterInstance(new MyService());
        endpointConfiguration.UseContainer<UnityBuilder>(c => c.UseExistingContainer(container));
        #endregion
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.SendFailedMessagesTo("error");

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

示例14: AsyncMain

 static async Task AsyncMain()
 {
     Console.Title = "Samples.CustomExtensionEndpoint";
     LogManager.Use<DefaultFactory>().Level(LogLevel.Info);
     var endpointConfiguration = new EndpointConfiguration("Samples.CustomExtensionEndpoint");
     endpointConfiguration.UsePersistence<InMemoryPersistence>();
     endpointConfiguration.EnableInstallers();
     await RunCustomizeConfiguration(endpointConfiguration)
         .ConfigureAwait(false);
     await RunBeforeEndpointStart()
         .ConfigureAwait(false);
     var endpointInstance = await Endpoint.Start(endpointConfiguration)
         .ConfigureAwait(false);
     await RunAfterEndpointStart(endpointInstance)
         .ConfigureAwait(false);
     try
     {
         Console.WriteLine("Press any key to exit");
         Console.ReadKey();
     }
     finally
     {
         await RunBeforeEndpointStop( endpointInstance)
             .ConfigureAwait(false);
         await endpointInstance.Stop()
             .ConfigureAwait(false);
     }
     await RunAfterEndpointStop()
         .ConfigureAwait(false);
 }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:30,代码来源:Program.cs

示例15: StaticHeaders

 public StaticHeaders()
 {
     #region header-static-endpoint
     EndpointConfiguration configuration = new EndpointConfiguration();
     configuration.AddHeaderToAllOutgoingMessages("MyGlobalHeader", "some static value");
     #endregion
 }
开发者ID:fivec,项目名称:docs.particular.net,代码行数:7,代码来源:StaticHeaders.cs


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