public HttpResponseMessage Post(Customer customer) { var message = new AddCustomerMessage { Name = customer.Name }; //Fully Azync Bus.Send("Receiver", message); return Request.CreateResponse(HttpStatusCode.Created); }
// POST api/values public async Task<HttpResponseMessage> Post(Customer customer) { var message = new AddCustomerMessage { Name = customer.Name }; //SendAndBlock var t = await Bus.Send("Receiver", message).Register<AddCustomerMessageResponse>(c => (AddCustomerMessageResponse)c.Messages[0]); return Request.CreateResponse(HttpStatusCode.Created, new Customer {Id = t.Id }); }