public void PublishConsumeAcknowledge(string queue, string message)
        {
            var before = new Class {
                String = message,
            };

            _service.Publish(queue, before);

            var(actual, deliveryTag) = _service.Consume <Class>(queue);

            Assert.NotNull(actual);
            Assert.Equal(message, actual.String);
            Assert.NotEqual(default, deliveryTag);
Exemple #2
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);
        }