private void PublishEvent(RemoteApprovalEvent approval) { var factory = new ConnectionFactory() { HostName = "localhost" }; using (var connection = factory.CreateConnection()) using (var channel = connection.CreateModel()) { channel.QueueDeclare(queue: "RaEvents", durable: false, exclusive: false, autoDelete: false, arguments: null); string message = JsonConvert.SerializeObject(approval); var body = Encoding.UTF8.GetBytes(message); channel.BasicPublish(exchange: "", routingKey: "RaEvents", basicProperties: null, body: body); Console.WriteLine(" [x] Sent {0}", message); } }
public ActionResult <IEnumerable <string> > PostRemoteApprovalEvent(RemoteApprovalEvent approval) { PublishEvent(approval); return(new string[] { "value1", "value2" }); }