Esempio n. 1
0
        public async Task <T> MailCreateAsync(T model, IHostingEnvironment hostEnv)
        {
            ///await elasticSearchService.CreateAsync();
            IndexResponseDTO indexResponse = await elasticSearchService.IndexAsync(model);

            bool rabbitMqResponse = await rabbitMqService.Publish(model, "mail.exchangeName", "mail.queue");

            T mail = await rabbitMqService.Consume("mail.exchangeName", "mail.queue");

            string body = mailHelper.CreateMailBody((MailRequest)(object)mail, hostEnv.WebRootPath);
            await mailHelper.SendAsync("mail example", body);

            return(mail);
        }