예제 #1
0
 public TheCommandHandler(EventPublisher publisher)
 {
     _publisher = publisher;
 }
예제 #2
0
        static void Main(string[] args)
        {
            IServiceBus bus = ServiceBusFactory.New(cfg =>
            {
                cfg.DisablePerformanceCounters();
                cfg.ReceiveFrom("rabbitmq://localhost/qqqq-app");
                cfg.UseRabbitMq(cf =>
                {
                    cf.ConfigureHost(new Uri("rabbitmq://localhost/qqqq-app"), hc =>
                    {
                        hc.SetUsername("petcar");
                        hc.SetPassword("?!Krone2009");
                    });
                });
            });

            EventPublisher publisher = new EventPublisher(bus);

            TheCommandHandler handler = new TheCommandHandler(publisher);
            bus.SubscribeHandler<AddItemCommand>(handler.Handle);
            bus.SubscribeHandler<UpdateItemCommand>(handler.Handle);
            bus.SubscribeHandler<DeleteItemCommand>(handler.Handle);

            Console.ReadKey();
        }