private async Task AddBookingAsync(AddBookingEvent data) { var emailAddress = "*****@*****.**"; var personalisation = new Dictionary <string, object>(); personalisation["FirstName"] = data.CandidateName; personalisation["SchoolName"] = data.SchoolName; personalisation["BookingDate"] = data.When.ToLongDateString(); personalisation["ConfirmUrl"] = "https://schoolexperiencebeta.azurewebsites.net/link/a9283b38"; await _notifyService.SendEmailAsync(emailAddress, CandidateBookingTemplate, personalisation); }
public async Task AddBooking(string bookingId, DateTime when, string schoolId, string schoolName, string candidateId, string candidateName, string subject) { var eventData = new AddBookingEvent { BookingId = bookingId, When = when, CandidateId = candidateId, CandidateName = candidateName, SchoolId = schoolId, SchoolName = schoolName, Subject = subject, }; await SendAsync(EventNames.AddBooking, eventData); }
public void PublishBookingRequest(string queueName, AddBookingEvent publishModel) { using (var channel = _connection.CreateModel()) { channel.QueueDeclare(queue: queueName, durable: false, exclusive: false, autoDelete: false, arguments: null); var message = JsonConvert.SerializeObject(publishModel); var body = Encoding.UTF8.GetBytes(message); IBasicProperties properties = channel.CreateBasicProperties(); properties.Persistent = true; properties.DeliveryMode = 2; channel.ConfirmSelect(); channel.BasicPublish(exchange: "", routingKey: queueName, mandatory: true, basicProperties: properties, body: body); channel.WaitForConfirmsOrDie(); channel.BasicAcks += (sender, eventArgs) => { Console.WriteLine("Sent RabbitMQ"); //implement ack handle }; channel.ConfirmSelect(); } }