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


C# SendOptions.RouteToThisEndpoint方法代码示例

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


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

示例1: IsRoutingToThisEndpoint_Should_Return_True_When_Routed_To_This_Endpoint

        public void IsRoutingToThisEndpoint_Should_Return_True_When_Routed_To_This_Endpoint()
        {
            var options = new SendOptions();

            options.RouteToThisEndpoint();

            Assert.IsTrue(options.IsRoutingToThisEndpoint());
        }
开发者ID:Particular,项目名称:NServiceBus,代码行数:8,代码来源:RoutingOptionExtensionsTests.cs

示例2: DeferTask

        static Task DeferTask(TaskDefinition taskDefinition, IPipelineContext context)
        {
            var options = new SendOptions();

            options.DelayDeliveryWith(taskDefinition.Every);
            options.RouteToThisEndpoint();

            return context.Send(new ScheduledTask
            {
                TaskId = taskDefinition.Id,
                Name = taskDefinition.Name,
                Every = taskDefinition.Every
            }, options);
        }
开发者ID:Particular,项目名称:NServiceBus,代码行数:14,代码来源:DefaultScheduler.cs

示例3: Should_route_to_local_endpoint_if_requested_so

        public async Task Should_route_to_local_endpoint_if_requested_so()
        {
            var behavior = InitializeBehavior(sharedQueue: "MyLocalAddress");
            var options = new SendOptions();

            options.RouteToThisEndpoint();

            var context = CreateContext(options);

            UnicastAddressTag addressTag = null;
            await behavior.Invoke(context, c =>
            {
                addressTag = (UnicastAddressTag)c.RoutingStrategies.Single().Apply(new Dictionary<string, string>());
                return TaskEx.CompletedTask;
            });

            Assert.AreEqual("MyLocalAddress", addressTag.Destination);
        }
开发者ID:Particular,项目名称:NServiceBus,代码行数:18,代码来源:UnicastSendRouterConnectorTests.cs

示例4: Should_throw_if_invalid_route_combinations_are_used

        public async Task Should_throw_if_invalid_route_combinations_are_used()
        {
            var behavior = InitializeBehavior(sharedQueue: "MyLocalAddress", instanceSpecificQueue: "MyInstance");

            try
            {
                var options = new SendOptions();

                options.RouteToThisInstance();
                options.SetDestination("Destination");

                var context = CreateContext(options);
                await behavior.Invoke(context, c => TaskEx.CompletedTask);
                Assert.Fail("RouteToThisInstance+SetDestination");
            }
            catch (Exception)
            {
                // ignored
            }

            try
            {
                var options = new SendOptions();

                options.RouteToThisEndpoint();
                options.SetDestination("Destination");

                var context = CreateContext(options);
                await behavior.Invoke(context, c => TaskEx.CompletedTask);
                Assert.Fail("RouteToThisEndpoint+SetDestination");
            }
            catch (Exception)
            {
                // ignored
            }

            try
            {
                var options = new SendOptions();

                options.RouteToThisEndpoint();
                options.RouteToThisInstance();

                var context = CreateContext(options);
                await behavior.Invoke(context, c => TaskEx.CompletedTask);
                Assert.Fail("RouteToThisEndpoint+RouteToThisInstance");
            }
            catch (Exception)
            {
                // ignored
            }
        }
开发者ID:Particular,项目名称:NServiceBus,代码行数:52,代码来源:UnicastSendRouterConnectorTests.cs

示例5: Schedule

        static Task Schedule(IMessageSession session, TaskDefinition taskDefinition)
        {
            logger.DebugFormat("Task '{0}' (with id {1}) scheduled with timeSpan {2}", taskDefinition.Name, taskDefinition.Id, taskDefinition.Every);

            var options = new SendOptions();
            options.DelayDeliveryWith(taskDefinition.Every);
            options.RouteToThisEndpoint();
            options.Context.GetOrCreate<ScheduleBehavior.State>().TaskDefinition = taskDefinition;

            var scheduledTask = new ScheduledTask
            {
                TaskId = taskDefinition.Id,
                Name = taskDefinition.Name,
                Every = taskDefinition.Every
            };
            return session.Send(scheduledTask, options);
        }
开发者ID:Particular,项目名称:NServiceBus,代码行数:17,代码来源:ScheduleExtensions.cs


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