public HttpResponseMessage Post(Customer customer) { var message = new AddCustomerMessage { Name = customer.Name }; //Fully Azync Bus.Send("Receiver", message); return Request.CreateResponse(HttpStatusCode.Created); }
static void Main(string[] args) { var message = new AddCustomerMessage { Name = "Steve" }; var bus = CreateBusCore(); //Fully Azync bus.Send("Receiver", message).Register(c => Console.WriteLine(((AddCustomerMessageResponse)c.Messages[0]).Id)); Console.WriteLine("Message Sent"); }
// 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 }); }