Exemple #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);

                    DateTime dataInicio = DateTime.Now;
                    dataInicio.AddDays(random.Next(1, 15));
                    var indicativoInteligenciaNegocioIntegrationEvent = new IndicativoInteligenciaNegocioIntegrationEvent()
                    {
                        PrevisaoVendas = random.Next(1000000, int.MaxValue),
                        DataInicio     = dataInicio,
                        DataFim        = dataInicio.AddDays(15)
                    };

                    var jsonString = JsonSerializer.Serialize(indicativoInteligenciaNegocioIntegrationEvent);

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

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

                Thread.Sleep(TimeSpan.FromHours(1));
            }
        }
Exemple #2
0
        public async Task <IActionResult> PublicarEvento([FromBody] IndicativoInteligenciaNegocioIntegrationEvent indicativoInteligenciaNegocioIntegrationEvent)
        {
            await _esbMuleIntegrationEventService.PublicarEvento(indicativoInteligenciaNegocioIntegrationEvent);

            return(Ok());
        }