Example #1
0
        public Task Handle(IReservationCheckedout message, IMessageHandlerContext context)
        {
            Console.WriteLine($"Reservation '{message.ReservationId}' checked out.", Color.Green);

            Data.ReservationId         = message.ReservationId;
            Data.ReservationCheckedOut = true;

            return(InitiatePaymentProcessing(context));
        }
Example #2
0
        public Task Handle(IReservationCheckedout message, IMessageHandlerContext context)
        {
            /*
             * We're done.
             *
             * We can debate if this should complete when the payment is authorized
             * or, as we are doing, a little earlier. By using the IReservationCheckedout
             * we could fall into the following scenario:
             * - the reservation is checked out
             * - the card authorization fails
             * - the reservation is gone.
             *
             * Poor experience. On the other end by waiting for the card authorization
             * we're locking tickets for more time. It's a business decision, not a
             * technical one.
             */

            Console.WriteLine($"IReservationCheckedout, I'm done.", Color.Green);
            MarkAsComplete();
            return(Task.CompletedTask);
        }