Exemplo n.º 1
0
 private static IEnumerable<Message> MakeMeSomeFakeData(int howMany)
 {
     var messages = new List<Message>();
     for (int i = 0; i < howMany; i++)
     {
         var message = new Message() { Content = "Message ID:" + i };
         messages.Add(message);
     }
     return messages;
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            //composition
            var kernel = new StandardKernel();
            kernel.Bind<IQueue>().To<Handler>();

            var messagesList = MakeMeSomeFakeData(0);
            var handler = kernel.Get<IQueue>();
            handler.Enqueue(messagesList);

            var message = new Message();
            while(message != null)
            {
                message = handler.Dequeue();
            }

            Console.WriteLine($"Dequeued: {message.Content}");
            Console.ReadLine();
        }