Beispiel #1
0
        static void Main(string[] args)
        {
            using (SalesDB context = new SalesDB())
            {
                EnsureMember(context.GetMemberRepository());
                Rebate rebate = EnsureRebate(context.GetRebateRepository());
                EnsureProduct(rebate, context.GetProductRepository());
            }

            Console.WriteLine("Subscribing to events...");

            var queue = new MsmqMessageQueueOutbound<Subscription>(
                ".",
                typeof(OrderShipped).FullName);
            queue.Send(new Subscription
            {
                Target = Environment.MachineName,
                QueueName = typeof(OrderShippedSubscriber).FullName
            });

            Console.WriteLine("Starting order shipped subscriber...");

            MessageProcessor<OrderShipped> processor =
                new MessageProcessor<OrderShipped>(
                    typeof(OrderShippedSubscriber).FullName,
                    () => new OrderShippedSubscriber());
            processor.Start();

            Console.ReadKey();

            processor.Stop();
        }
        static void Main(string[] args)
        {
            using (SalesDB context = new SalesDB())
            {
                EnsureMember(context.GetMemberRepository());
                Rebate rebate = EnsureRebate(context.GetRebateRepository());
                EnsureProduct(rebate, context.GetProductRepository());
            }

            Console.WriteLine("Subscribing to events...");

            var queue = new MsmqMessageQueueOutbound <Subscription>(
                ".",
                typeof(OrderShipped).FullName);

            queue.Send(new Subscription
            {
                Target    = Environment.MachineName,
                QueueName = typeof(OrderShippedSubscriber).FullName
            });

            Console.WriteLine("Starting order shipped subscriber...");

            MessageProcessor <OrderShipped> processor =
                new MessageProcessor <OrderShipped>(
                    typeof(OrderShippedSubscriber).FullName,
                    () => new OrderShippedSubscriber());

            processor.Start();

            Console.ReadKey();

            processor.Stop();
        }