public async Task <ActionResult <Product> > Get(int id) { var requestClient = _busControl.CreatePublishRequestClient <MessageCommand, MessageCommand>(TimeSpan.FromSeconds(10)); var res = await requestClient.Request(new MessageCommand { Message = "Ping" }).ConfigureAwait(false); var p = _productRepository.FakeSource.FirstOrDefault(x => x.Id == id); p.Name += " - " + res.Message; return(p); }
static void Main() { try { CreateMtBus(); var requestClient = _mtBus.CreatePublishRequestClient <TestRequest, TestResponse>(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5)); var response = requestClient.Request(new TestRequest()); string contentStr = response.Result.Content; } catch (Exception e) { Console.WriteLine("Exception: " + e); } //_mtBus.Stop(); }