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


C# IBus.Request方法代码示例

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


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

示例1: SendMessages

 public override IEnumerable<Task> SendMessages(IBus bus)
 {
     for (var i = 0; i < NumMessagesToSend; i++)
     {
         yield return bus.Request(new FooRequest());
         Console.Write(".");
     }
     Console.WriteLine();
 }
开发者ID:joshka,项目名称:Nimbus,代码行数:9,代码来源:WhenSendingManyRequestsOfTheSameType.cs

示例2: SendMessages

 public override async Task SendMessages(IBus bus, Func<bool> shouldKeepSending)
 {
     while (shouldKeepSending())
     {
         var response = await bus.Request(new FooRequest(), TimeSpan.FromSeconds(TimeoutSeconds));
         StressTestMessageHandler.RecordResponseMessageReceipt(response);
         IncrementExpectedMessageCount();
     }
 }
开发者ID:fenix2222,项目名称:Nimbus,代码行数:9,代码来源:WhenSendingManyRequestsOfTheSameType.cs

示例3: Initialize

 public void Initialize(IBus bus)
 {
     bus.Subscribe<StartMessage>("id", startMessage =>
     {
         var request = new TestRequestMessage {Text = startMessage.Text};
         bus.Request<TestRequestMessage, TestResponseMessage>(request, response =>
         {
             var endMessage = new EndMessage {Text = response.Text};
             bus.Publish(endMessage);
         });
     });
 }
开发者ID:redsquare,项目名称:EasyNetQ,代码行数:12,代码来源:RequestResponseSaga.cs

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

示例5: SendEnumMessage

    static async void SendEnumMessage(IBus bus)
    {
        #region SendEnumMessage

        SendOptions sendOptions = new SendOptions();
        sendOptions.SetDestination("Samples.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:eclaus,项目名称:docs.particular.net,代码行数:14,代码来源:Program.cs

示例6: SendIntMessage

    static async void SendIntMessage(IBus bus)
    {
        #region SendIntMessage

        IntMessage message = new IntMessage();

        SendOptions sendOptions = new SendOptions();
        sendOptions.SetDestination("Samples.Callbacks.Receiver");
        int response = await bus.Request<int>(message, sendOptions);
        Console.WriteLine("Callback received with response:" + response);

        #endregion

        Console.WriteLine("Message sent");
    }
开发者ID:eclaus,项目名称:docs.particular.net,代码行数:15,代码来源:Program.cs

示例7: Initialize

 public void Initialize(IBus bus)
 {
     bus.Subscribe<StartMessage>("simpleSaga", startMessage =>
     {
         Console.WriteLine("StartMessage: {0}", startMessage.Text);
         var firstProcessedMessage = startMessage.Text + " - initial process ";
         var request = new TestRequestMessage { Text = firstProcessedMessage };
         bus.Request<TestRequestMessage, TestResponseMessage>(request, response =>
         {
             Console.WriteLine("TestResponseMessage: {0}", response.Text);
             var secondProcessedMessage = response.Text + " - final process ";
             var endMessage = new EndMessage { Text = secondProcessedMessage };
             bus.Publish(endMessage);
         });
     });
 }
开发者ID:ngbrown,项目名称:EasyNetQ,代码行数:16,代码来源:TestSaga.cs

示例8: SendCommand

    static async void SendCommand(IBus bus)
    {
        Guid commandId = Guid.NewGuid();

        SendOptions sendOptions = new SendOptions();
        sendOptions.SetCorrelationId(commandId.ToString());
        MyCommand message = new MyCommand();
        var response =  await bus.Request<CommandStatus>(new MyCommand
        {
            CommandId = commandId,
            EncryptedString = "Some sensitive information"
        }, sendOptions);
        Console.WriteLine("Callback received with response:" + response);
        Console.WriteLine("Command sent id: " + commandId);

    }
开发者ID:RichieYang,项目名称:docs.particular.net,代码行数:16,代码来源:CommandSender.cs


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