コード例 #1
0
 /// <summary>
 /// 在订阅者的构造中注册事件
 /// </summary>
 /// <param name="sender"></param>
 public BaseEventSubscriber(BaseEventSender sender)
 {
     this.factory         = new ConnectionFactory();
     factory.HostName     = "localhost";
     factory.UserName     = "******";
     factory.Password     = "******";
     sender.OnDataChange += new BaseEventSender.MqHandler(this.BaseSubscriberProxyMethod);
 }
コード例 #2
0
        /// <summary>
        /// 测试方法
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            BaseEventSender     sender     = new BaseEventSender(1000);
            BaseEventSubscriber subscriber = new BaseEventSubscriber(sender);

            sender.Run();
            RabbitMqMessageReceiver receiver = new RabbitMqMessageReceiver();

            receiver.ReceiveMessage();
            Console.ReadKey();
        }
コード例 #3
0
 /// <summary>
 /// 反注册事件
 /// </summary>
 /// <param name="sender"></param>
 public void UnRegisterBaseEventSender(BaseEventSender sender)
 {
     sender.OnDataChange -= new BaseEventSender.MqHandler(this.BaseSubscriberProxyMethod);
 }