Esempio n. 1
0
        public static async Task Simular(string URL)
        {
            Random random = new Random();

            while (true)
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(URL);

                    int orcamentos = random.Next(3000, 9000);
                    var relacaoOrcamentoVendasIntegrationEvent = new RelacaoOrcamentoVendasIntegrationEvent()
                    {
                        Orcamentos = orcamentos,
                        Vendas     = orcamentos - random.Next(800, 2000) - new Random(orcamentos).Next(0, 99)
                    };

                    var jsonString = JsonSerializer.Serialize(relacaoOrcamentoVendasIntegrationEvent);

                    var data = new StringContent(jsonString, Encoding.UTF8, "application/json");

                    await client.PostAsync("/api/Mule/PublicarEvento/RelacaoOrcamentoVendas", data);
                }

                Thread.Sleep(TimeSpan.FromSeconds(10));
            }
        }
Esempio n. 2
0
        public async Task <IActionResult> PublicarEvento([FromBody] RelacaoOrcamentoVendasIntegrationEvent relacaoOrcamentoVendasIntegrationEvent)
        {
            await _esbMuleIntegrationEventService.PublicarEvento(relacaoOrcamentoVendasIntegrationEvent);

            return(Ok());
        }