本文整理汇总了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());
}
示例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);
}
示例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);
}
示例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
}
}
示例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);
}