Exemple #1
0
        static void Main(string[] args)
        {
            Log.WriteLine("Start");

            QueueUow uow = new QueueUow();

            var personQueueWithDeadLetter = new PersonDeadLetterQueue(uow);

            Log.WriteLine("..:: Generating world ::..");

            for (int i = 0; i < 100; i++)
            {
                var newPerson = new Person()
                {
                    Age = i, Name = NameGenerator.Generate()
                };
                Log.WriteLine($"..:: Sending {newPerson.Name} to World! ::..");

                personQueueWithDeadLetter.Push(newPerson);
            }

            Log.WriteLine("..:: World is full of peoples ::..");
            Log.WriteLine("...");

            var personQueue = new PersonQueue(uow);

            Log.WriteLine("..:: Game Start ::..");
            personQueueWithDeadLetter.ReadQueue((person) =>
            {
                Log.WriteLine("...");

                Log.WriteLine("-Shhh, there's someone comming...");

                Task.Delay(500).Wait();

                RollTheDice();

                Log.WriteLine(person.SeyHello());

                personQueue.Push(person);
            });

            Log.WriteLine("Stop");
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Log.WriteLine("Start");

            var queue = new PersonQueue(new QueueUow());

            {
                for (int i = 0; i < 1000; i++)
                {
                    string message = $"I'm number {i}";
                    Log.WriteLine($"pushing: '{message}'");

                    queue.Push(new Core.Entities.Person()
                    {
                        Age = i, Name = "Mr Jhon"
                    });
                }
            }

            Log.WriteLine("Stop");

            Log.WriteLine("...");
            Console.ReadKey();
        }