本文整理汇总了C#中SendOptions.SetDestination方法的典型用法代码示例。如果您正苦于以下问题:C# SendOptions.SetDestination方法的具体用法?C# SendOptions.SetDestination怎么用?C# SendOptions.SetDestination使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SendOptions
的用法示例。
在下文中一共展示了SendOptions.SetDestination方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendObjectMessage
public async Task<ActionResult> SendObjectMessage()
{
var message = new ObjectMessage();
var sendOptions = new SendOptions();
sendOptions.SetDestination("Samples.Callbacks.Receiver");
Task<ObjectResponseMessage> responseTask = MvcApplication.EndpointInstance.Request<ObjectResponseMessage>(message, sendOptions);
return View("SendObjectMessage", await responseTask.ConfigureAwait(false));
}
示例2: SendObjectMessage
public async Task<ActionResult> SendObjectMessage()
{
ObjectMessage message = new ObjectMessage();
SendOptions sendOptions = new SendOptions();
sendOptions.SetDestination("Samples.Callbacks.Receiver");
Task<ObjectResponseMessage> responseTask = MvcApplication.Endpoint.Request<ObjectResponseMessage>(message, sendOptions);
return View("SendObjectMessage", await responseTask);
}
示例3: SendEnumMessage
public async Task<ActionResult> SendEnumMessage()
{
var message = new EnumMessage();
var sendOptions = new SendOptions();
sendOptions.SetDestination("Samples.Callbacks.Receiver");
Task<Status> statusTask = MvcApplication.EndpointInstance.Request<Status>(message, sendOptions);
return View("SendEnumMessage", await statusTask.ConfigureAwait(false));
}
示例4: SendEnumMessage
public async Task<ActionResult> SendEnumMessage()
{
EnumMessage message = new EnumMessage();
SendOptions sendOptions = new SendOptions();
sendOptions.SetDestination("Samples.Callbacks.Receiver");
Task<Status> statusTask = MvcApplication.BusSession.Request<Status>(message, sendOptions);
return View("SendEnumMessage", await statusTask);
}
示例5: SendIntMessage
public async Task<ActionResult> SendIntMessage()
{
IntMessage message = new IntMessage();
SendOptions sendOptions = new SendOptions();
sendOptions.SetDestination("Samples.Callbacks.Receiver");
Task<int> statusTask = MvcApplication.Endpoint.Request<int>(message, sendOptions);
return View("SendIntMessage", await statusTask);
}
示例6: SendOptions_GetDestination_Should_Return_Configured_Destination
public void SendOptions_GetDestination_Should_Return_Configured_Destination()
{
const string expectedDestination = "custom send destination";
var options = new SendOptions();
options.SetDestination(expectedDestination);
var destination = options.GetDestination();
Assert.AreEqual(expectedDestination, destination);
}
示例7: Should_set_messageintent_to_send
public async Task Should_set_messageintent_to_send()
{
var behavior = InitializeBehavior();
var options = new SendOptions();
options.SetDestination("destination endpoint");
var context = CreateContext(options);
await behavior.Invoke(context, ctx => TaskEx.CompletedTask);
Assert.AreEqual(1, context.Headers.Count);
Assert.AreEqual(MessageIntentEnum.Send.ToString(), context.Headers[Headers.MessageIntent]);
}
示例8: SendEnumMessage
static async Task SendEnumMessage(IBusSession busSession)
{
Console.WriteLine("Message sent");
#region SendEnumMessage
EnumMessage message = new EnumMessage();
SendOptions sendOptions = new SendOptions();
sendOptions.SetDestination("Samples.Callbacks.Receiver");
Status status = await busSession.Request<Status>(message, sendOptions);
Console.WriteLine("Callback received with status:" + status);
#endregion
}
示例9: SendIntMessage
static async Task SendIntMessage(IBusSession busSession)
{
Console.WriteLine("Message sent");
#region SendIntMessage
IntMessage message = new IntMessage();
SendOptions sendOptions = new SendOptions();
sendOptions.SetDestination("Samples.Callbacks.Receiver");
int response = await busSession.Request<int>(message, sendOptions);
Console.WriteLine("Callback received with response:" + response);
#endregion
}
示例10: BuildSendOptions
private static SendOptions BuildSendOptions(Guid routingSlipId, string[] destinations)
{
var routingSlip = new RoutingSlip(routingSlipId, destinations);
var firstRouteDefinition = routingSlip.Itinerary.First();
var json = JsonConvert.SerializeObject(routingSlip);
var options = new SendOptions();
options.SetHeader(Router.RoutingSlipHeaderKey, json);
options.SetDestination(firstRouteDefinition.Address);
return options;
}
示例11: SendObjectMessage
static async void SendObjectMessage(IBus bus)
{
#region SendObjectMessage
ObjectMessage message = new ObjectMessage();
SendOptions sendOptions = new SendOptions();
sendOptions.SetDestination("Samples.Callbacks.Receiver");
ObjectResponseMessage response = await bus.Request<ObjectResponseMessage>(message, sendOptions);
Console.WriteLine("Callback received with response property value:" + response.Property);
#endregion
Console.WriteLine("Message sent");
}
示例12: Route
public static async Task Route(this IBusContext bus, object message, Guid routingSlipId, params string[] destinations)
{
var routingSlip = new RoutingSlip(routingSlipId, destinations);
var firstRouteDefinition = routingSlip.Itinerary.First();
var json = JsonConvert.SerializeObject(routingSlip);
var options = new SendOptions();
options.SetHeader(Router.RoutingSlipHeaderKey, json);
options.SetDestination(firstRouteDefinition.Address);
await bus.Send(message, options);
}
示例13: SendEnumMessage
static async void SendEnumMessage(IBus bus)
{
#region SendEnumMessage
SendOptions sendOptions = new SendOptions();
sendOptions.SetDestination("Sample.Callbacks.Receiver");
EnumMessage message = new EnumMessage();
Status status = await bus.Request<Status>(message, sendOptions);
Console.WriteLine("Callback received with status:" + status);
#endregion
Console.WriteLine("Message sent");
}
示例14: SendOrder
static async Task SendOrder(IEndpointInstance endpointInstance)
{
Console.WriteLine("Press '1' to send PlaceOrder - defer message handling");
Console.WriteLine("Press '2' to send PlaceDelayedOrder - defer message delivery");
Console.WriteLine("Press enter key to exit");
while (true)
{
ConsoleKeyInfo key = Console.ReadKey();
Console.WriteLine();
Guid id = Guid.NewGuid();
switch (key.Key)
{
case ConsoleKey.D1:
#region SendOrder
PlaceOrder placeOrder = new PlaceOrder
{
Product = "New shoes",
Id = id
};
await endpointInstance.Send("Samples.DelayedDelivery.Server", placeOrder);
Console.WriteLine("[Defer Message Handling] Sent a new PlaceOrder message with id: {0}", id.ToString("N"));
#endregion
continue;
case ConsoleKey.D2:
#region DeferOrder
PlaceDelayedOrder placeDelayedOrder = new PlaceDelayedOrder
{
Product = "New shoes",
Id = id
};
SendOptions options = new SendOptions();
options.SetDestination("Samples.DelayedDelivery.Server");
options.DelayDeliveryWith(TimeSpan.FromSeconds(5));
await endpointInstance.Send(placeDelayedOrder, options);
Console.WriteLine("[Defer Message Delivery] Deferred a new PlaceDelayedOrder message with id: {0}", id.ToString("N"));
#endregion
continue;
case ConsoleKey.Enter:
return;
default:
return;
}
}
}
示例15: SendEnumMessage
static async Task SendEnumMessage(IEndpointInstance endpointInstance)
{
Console.WriteLine("Message sent");
#region SendEnumMessage
var message = new EnumMessage();
var sendOptions = new SendOptions();
sendOptions.SetDestination("Samples.Callbacks.Receiver");
var status = await endpointInstance.Request<Status>(message, sendOptions)
.ConfigureAwait(false);
Console.WriteLine("Callback received with status:" + status);
#endregion
}