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


C# SendOptions.SetDestination方法代码示例

本文整理汇总了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));
 }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:8,代码来源:HomeController.cs

示例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);
 }
开发者ID:vanwyngardenk,项目名称:docs.particular.net,代码行数:8,代码来源:HomeController.cs

示例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));
 }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:8,代码来源:HomeController.cs

示例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);
 }
开发者ID:cdnico,项目名称:docs.particular.net,代码行数:8,代码来源:HomeController.cs

示例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);
 }
开发者ID:vanwyngardenk,项目名称:docs.particular.net,代码行数:8,代码来源:HomeController.cs

示例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);
        }
开发者ID:Particular,项目名称:NServiceBus,代码行数:10,代码来源:RoutingOptionExtensionsTests.cs

示例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]);
        }
开发者ID:Particular,项目名称:NServiceBus,代码行数:12,代码来源:UnicastSendRouterConnectorTests.cs

示例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
    }
开发者ID:vanwyngardenk,项目名称:docs.particular.net,代码行数:12,代码来源:Program.cs

示例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
    }
开发者ID:vanwyngardenk,项目名称:docs.particular.net,代码行数:13,代码来源:Program.cs

示例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;
        }
开发者ID:jbogard,项目名称:NServiceBus.MessageRouting,代码行数:13,代码来源:RoutableMessageBusExtensions.cs

示例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");
    }
开发者ID:eclaus,项目名称:docs.particular.net,代码行数:14,代码来源:Program.cs

示例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);
        }
开发者ID:nmt1994,项目名称:NServiceBus.MessageRouting,代码行数:14,代码来源:RoutableMessageBusExtensions.cs

示例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");
    }
开发者ID:pedroreys,项目名称:docs.particular.net,代码行数:14,代码来源:Program.cs

示例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;
            }
        }

    }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:49,代码来源:Program.cs

示例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
    }
开发者ID:chriscatilo,项目名称:docs.particular.net,代码行数:15,代码来源:Program.cs


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