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


C# FutureMessage.WaitUntilAvailable方法代码示例

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


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

示例1: Should_return_the_matching_details_for_the_order

		public void Should_return_the_matching_details_for_the_order()
		{
			var response = new FutureMessage<OrderDetailsResponse>();

			LocalBus.Subscribe<OrderDetailsResponse>(response.Set);

			const string orderId = "ABC123";
			const string customerId = "12345";
			var request = new SendOrderDetailsRequest
				{
					RequestId = CombGuid.Generate(),
					CustomerId = customerId,
					OrderId = orderId,
				};
			LocalBus.Publish(request, x => x.SendResponseTo(LocalBus.Endpoint));

			Assert.IsTrue(response.WaitUntilAvailable(5.Seconds()), "The response was not received");

			Assert.AreEqual(orderId, response.Message.OrderId);
			Assert.AreEqual(customerId, response.Message.CustomerId);
		}
开发者ID:KevM,项目名称:MassTransit,代码行数:21,代码来源:Proxy_Specs.cs

示例2: EstablishContext

        protected override void EstablishContext()
        {
            base.EstablishContext();

            _ping = new PingMessage();

            _faultFuture = new FutureMessage<Fault<PingMessage, Guid>>();
            _future = new FutureMessage<PingMessage, Guid>(_ping.CorrelationId);

            LocalBus.SubscribeHandler<PingMessage>(message =>
                {
                    _future.Set(message);

                    throw new NotSupportedException("I am a naughty consumer! I go boom!");
                });

            LocalBus.SubscribeHandler<Fault<PingMessage, Guid>>(message => _faultFuture.Set(message));

            LocalBus.Publish(_ping);

            _future.WaitUntilAvailable(1.Seconds());
        }
开发者ID:rajwilkhu,项目名称:MassTransit,代码行数:22,代码来源:NonTransactional_Specs.cs


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