Exemplo n.º 1
0
        public void Start()
        {
            //Configure Bus
            var rabbitConfiguration = new RabbitConfiguration();

            rabbitConfiguration.Configure("MainClientAppService");
            //Configure where the commands sent by this service are forwarded to.
            Transport.RouteToEndpoint(typeof(MakeAppointment), BookingServiceConstants.ServiceName);

            var bus = new Publisher();

            //User Input
            do
            {
                Console.WriteLine("Enter a date with format (dd/mm/yyyy): ");
                var ddMMyyyy               = Convert.ToString(Console.ReadLine());
                var splitedValues          = ddMMyyyy.Split('/');
                var makeAppointmentCommand = new MakeAppointment
                {
                    Date = new DateTime(int.Parse(splitedValues[2]), int.Parse(splitedValues[1]), int.Parse(splitedValues[0]))
                };
                Console.WriteLine("What is your Name?");
                makeAppointmentCommand.Name = Convert.ToString(Console.ReadLine());
                bus.Send(makeAppointmentCommand);

                Thread.Sleep(5000);
            } while (true);
        }
Exemplo n.º 2
0
        public void Start()
        {
            // write code here that runs when the Windows Service starts up.

            var rabbitConfiguration = new RabbitConfiguration();

            rabbitConfiguration.Configure(BookingServiceConstants.ServiceName);

            //var publisher = new Publisher();
            //publisher.PublishMessage(new AppointmentBooked { Name = "Diego Test Appointment" });
            //Thread.Sleep(5000);
            //publisher.PublishMessage(new AppointmentDenied { Reason = "Esta ocupado" });
        }
Exemplo n.º 3
0
        public void Start()
        {
            // write code here that runs when the Windows Service starts up.
            var rabbitConfiguration = new RabbitConfiguration();

            rabbitConfiguration.Configure("AlertService");

            //do
            //{
            //    Console.WriteLine("Enter a date with format (dd/mm/yyyy): ");
            //    var ddMMyyyy = Convert.ToString(Console.ReadLine());
            //    var splitedValues = ddMMyyyy.Split('/');
            //    var reservationDate = new DateTime(int.Parse(splitedValues[2]), int.Parse(splitedValues[1]), int.Parse(splitedValues[0]));
            //} while (true);
        }