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


C# EndpointConfiguration.UnicastRouting方法代码示例

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


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

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

示例2: StaticRoutes

        void StaticRoutes(EndpointConfiguration endpointConfiguration)
        {
            #region Routing-StaticRoutes-Endpoint

            endpointConfiguration.UnicastRouting().RouteToEndpoint(typeof(AcceptOrder), "Sales");

            #endregion

            #region Routing-StaticRoutes-Endpoint-Msmq

            endpointConfiguration.UnicastRouting().RouteToEndpoint(typeof(AcceptOrder), "Sales");

            #endregion

            #region Routing-StaticRoutes-Endpoint-Broker

            endpointConfiguration.UnicastRouting().RouteToEndpoint(typeof(AcceptOrder), "Sales");

            #endregion

            #region Routing-StaticRoutes-Address

            endpointConfiguration.UnicastRouting().Mapping.Logical
                .RouteToAddress(typeof(AcceptOrder), "[email protected]");

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

示例3: AsyncMain

    static async Task AsyncMain()
    {
        Console.Title = "Samples.SenderSideScaleOut.UnawareCilent";
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.SenderSideScaleOut.UnawareCilent");
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.SendFailedMessagesTo("error");

        endpointConfiguration.UnicastRouting()
            .RouteToEndpoint(typeof(DoSomething), "Samples.SenderSideScaleOut.Server");

        IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
        Console.WriteLine("Press enter to send a message");
        Console.WriteLine("Press any key to exit");
        while (true)
        {
            ConsoleKeyInfo key = Console.ReadKey();
            if (key.Key != ConsoleKey.Enter)
            {
                break;
            }
            await endpoint.Send(new DoSomething());
            Console.WriteLine("Message Sent");
        }
        await endpoint.Stop();
    }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:25,代码来源:Program.cs

示例4: CustomRoutingStore

        void CustomRoutingStore(EndpointConfiguration endpointConfiguration)
        {
            #region Routing-CustomRoutingStore

            endpointConfiguration.UnicastRouting().Mapping.Logical.AddDynamic((t, c) =>
                LoadFromCache(t) ?? LoadFromDatabaseAndPutToCache(t));

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

示例5: StaticEndpointMapping

        void StaticEndpointMapping(EndpointConfiguration endpointConfiguration)
        {
            #region Routing-StaticEndpointMapping

            EndpointName sales = new EndpointName("Sales");
            endpointConfiguration.UnicastRouting().Mapping.Physical
                .Add(sales,
                    new EndpointInstance(sales, "1", null),
                    new EndpointInstance(sales, "2", null));

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

示例6: InputQueueOverrideRouting

        void InputQueueOverrideRouting(EndpointConfiguration endpointConfiguration)
        {
            #region InputQueueOverrideRouting

            var unicastRouting = endpointConfiguration.UnicastRouting();
            unicastRouting.RouteToEndpoint(typeof(MyMessage), "MyEndpoint");
            var transport = endpointConfiguration.UseTransport<MyTransport>();
            transport.AddAddressTranslationException(
                new EndpointInstance("MyEndpoint"), "MyEndpoint.Messages");

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

示例7: DynamicRoutes

        void DynamicRoutes(EndpointConfiguration endpointConfiguration)
        {
            #region Routing-DynamicRoutes

            endpointConfiguration.UnicastRouting().Mapping.Logical
                .AddDynamic((types, contextBag) => new[]
                {
                    //Use endpoint name
                    new UnicastRoute("Sales"),
                    //Use endpoint instance name
                    new UnicastRoute(new EndpointInstance("Sales", "1")),
                    //Use transport address (e.g. MSMQ)
                    new UnicastRoute("[email protected]")
                });

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

示例8: AsyncMain

    static async Task AsyncMain()
    {
        Console.Title = "Samples.SenderSideScaleOut.AwareClient";
        var endpointConfiguration = new EndpointConfiguration("Samples.SenderSideScaleOut.AwareClient");
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.SendFailedMessagesTo("error");

        #region Logical-Routing

        var routing = endpointConfiguration.UnicastRouting();
        routing.RouteToEndpoint(typeof(DoSomething), "Samples.SenderSideScaleOut.Server");

        #endregion

        #region File-Based-Routing

        var transport = endpointConfiguration.UseTransport<MsmqTransport>();
        transport.DistributeMessagesUsingFileBasedEndpointInstanceMapping("routes.xml");

        #endregion

        var endpointInstance = await Endpoint.Start(endpointConfiguration)
            .ConfigureAwait(false);
        Console.WriteLine("Press enter to send a message");
        Console.WriteLine("Press any key to exit");

        var sequenceId = 0;
        while (true)
        {
            var key = Console.ReadKey();
            if (key.Key != ConsoleKey.Enter)
            {
                break;
            }
            var command = new DoSomething { SequenceId = ++sequenceId };
            await endpointInstance.Send(command)
                .ConfigureAwait(false);
            Console.WriteLine($"Message {command.SequenceId} Sent");
        }
        await endpointInstance.Stop()
            .ConfigureAwait(false);
    }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:42,代码来源:Program.cs

示例9: Usage

        Usage()
        {
            #region EndpointNameCode

            EndpointConfiguration endpointConfiguration = new EndpointConfiguration("MyEndpoint");

            #endregion

            #region InputQueueName

            endpointConfiguration.UseTransport<MyTransport>().AddAddressTranslationException(
                new EndpointInstance("MyEndpoint"), "MyEndpoint.Messages");

            #endregion

            #region InputQueueOverrideRouting

            endpointConfiguration.UnicastRouting().RouteToEndpoint(typeof(MyMessage), "MyEndpoint");
            endpointConfiguration.UseTransport<MyTransport>().AddAddressTranslationException(
                new EndpointInstance("MyEndpoint"), "MyEndpoint.Messages");

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

示例10: DynamicEndpointMapping

        void DynamicEndpointMapping(EndpointConfiguration endpointConfiguration)
        {
            #region Routing-DynamicEndpointMapping

            endpointConfiguration.UnicastRouting().Mapping.Physical.AddDynamic(async e =>
            {
                if (e.ToString().StartsWith("Sales"))
                {
                    return new[]
                    {
                        new EndpointInstance(e, "1").SetProperty("SomeProp", "SomeValue"),
                        new EndpointInstance(e, "2").AtMachine("B")
                    };
                }
                return null;
            });

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

示例11: FileBasedRoutingAdvanced

        public void FileBasedRoutingAdvanced()
        {
            EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Endpoint");

            #region Routing-FileBased-ConfigAdvanced

            endpointConfiguration.UnicastRouting().Mapping
                .DistributeMessagesUsingFileBasedEndpointInstanceMapping(@"C:\Routes.xml");

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

示例12: FileBasedRouting

        void FileBasedRouting(EndpointConfiguration endpointConfiguration)
        {
            #region Routing-FileBased-Config

            endpointConfiguration.UnicastRouting().RouteToEndpoint(typeof(AcceptOrder), "Sales");
            endpointConfiguration.UnicastRouting().RouteToEndpoint(typeof(SendOrder), "Shipping");

            endpointConfiguration.UseTransport<MsmqTransport>()
                .DistributeMessagesUsingFileBasedEndpointInstanceMapping(@"C:\Routes.xml");

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


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