示例#1
0
        static void TestEventbus()
        {
            var config = new MqConfig
            {
                UserName     = "******",
                Password     = "******",
                HostIp       = "localhost",
                Port         = 5672,
                Exchange     = "Eventbus",
                ExchangeType = "direct",
                VirtualHost  = "/"
            };
            var manager = new MessageHandlerManager(config);

            manager.Register <TestEvent>(new ActionEventHandler <TestEvent>(TestActionHandler));
            manager.Register <TestEvent>(new TestEventHandler());
            manager.Register <TestEvent>(new TestMessageHandler());
            manager.Register <TestEvent>(new MessageHandlerTest());

            Console.ReadLine();

            manager.Unregister <TestEvent>(typeof(TestMessageHandler));
        }
示例#2
0
        static void Main(string[] args)
        {
            var mqconfig = new MqConfig
            {
                UserName     = "******",
                Password     = "******",
                HostIp       = "localhost",
                Port         = 5672,
                VirtualHost  = "/",
                Exchange     = "Abs.Exchange",
                ExchangeType = "direct",
                Durable      = true,
                AutoDelete   = false
            };
            var ehm = new MessageHandlerManager(mqconfig);

            //_eventbus = new EventBus(ehm);
            ehm.Register <HelloEvent>(new HelloEventHandler());
            Console.ReadLine();
        }