Beispiel #1
0
        /// <inheritdoc />
        public Task SendWashStartedMessageAsync(Reservation reservation)
        {
            var message = new ReservationServiceBusMessage
            {
                UserId        = reservation.UserId,
                ReservationId = reservation.Id,
            };

            return(SendMessage(_configuration.ServiceBusQueues.BotWashStartedQueue, message));
        }
Beispiel #2
0
        /// <inheritdoc />
        public Task SendCarWashCommentLeftMessageAsync(Reservation reservation)
        {
            var message = new ReservationServiceBusMessage
            {
                UserId        = reservation.UserId,
                ReservationId = reservation.Id,
            };

            return(SendMessage(_configuration.ServiceBusQueues.BotCarWashCommentLeftQueue, message));
        }
Beispiel #3
0
        /// <inheritdoc />
        public Task SendDropoffReminderMessageAsync(Reservation reservation)
        {
            var message = new ReservationServiceBusMessage
            {
                UserId        = reservation.UserId,
                ReservationId = reservation.Id,
            };

            return(SendMessage(_configuration.ServiceBusQueues.BotDropoffReminderQueue, message));
        }
Beispiel #4
0
        public static async Task SendBotReminderMessage(Reservation reservation, string queueName)
        {
            var connectionString = Environment.GetEnvironmentVariable("ServiceBus", EnvironmentVariableTarget.Process);
            var queueClient      = new QueueClient(connectionString, queueName);

            var message = new ReservationServiceBusMessage
            {
                UserId        = reservation.UserId,
                ReservationId = reservation.Id,
            };

            // Create a new message to send to the queue.
            var serviceBusMessage = new Message(Encoding.UTF8.GetBytes(message.ToJson()));

            // Send the message to the queue.
            try { await queueClient.SendAsync(serviceBusMessage); }
            catch (Exception e)
            {
                throw new Exception($"Failed to send message to the bot, who would have pinged the user with id: {reservation.UserId}. See inner exception.", e);
            }

            await queueClient.CloseAsync();
        }