public void SendCommunicationReceita(int empresaId) { Empresa emp = this.Find(empresaId); String host = ConfigurationManager.AppSettings["RabbitMQHost"]; String user = ConfigurationManager.AppSettings["RabbitMQUser"]; String pass = ConfigurationManager.AppSettings["RabbitMQPass"]; String exchange = ConfigurationManager.AppSettings["RabbitMQExchange"]; try { using (RabbitMQProducer rabbit = new RabbitMQProducer(host, user, pass, exchange, emp.RabbitmqQueue)) { GetValuesModel gvm = new GetValuesModel(); gvm.GetValuesEnum = GetValuesEnum.GetReceitas; using (MemoryStream ms = new MemoryStream()) { DataContractJsonSerializer deserializer = new DataContractJsonSerializer(typeof(GetValuesModel)); deserializer.WriteObject(ms, gvm); rabbit.Produce(ms.ToArray()); } } } catch (Exception ex) { throw new Exception("A Mensagem não foi enviado para o Rabbit."); } }