コード例 #1
0
        // POST api/order
        public void Post([FromBody] TeslaOrder order)
        {
            //in real world inject the bus
            //this is creating connection to the rabbit mq
            var messageBus = RabbitHutch.CreateBus("host=localhost");

            messageBus.Publish(order);
        }
コード例 #2
0
        public IActionResult Post([FromBody] TeslaOrder order)
        {
            using (var bus = RabbitHutch.CreateBus("host=localhost"))
            {
                bus.Publish(order);
            }

            return(Ok());
        }
コード例 #3
0
 public IActionResult Get([FromQuery] TeslaOrder order)
 {
     return(Ok(new { id = 5 }));
 }