コード例 #1
0
        public HttpResponseMessage Post(Customer customer)
        {
            var message = new AddCustomerMessage { Name = customer.Name };
            //Fully Azync
            Bus.Send("Receiver", message);

            return Request.CreateResponse(HttpStatusCode.Created);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: justinsaraceno/NsTest
        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");
        }
コード例 #3
0
        // 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 });



        }