コード例 #1
0
        public void StartWatchingTopicEvents()
        {
            var topicEventListener = new ZkTopicEventListener(this);

            ZkUtils.MakeSurePersistentPathExists(zkClient, ZkUtils.BrokerTopicsPath);

            this.zkClient.SubscribeStateChanges(new ZkSessionExpireListener(this, topicEventListener));

            var topics = this.zkClient.SubscribeChildChanges(ZkUtils.BrokerTopicsPath, topicEventListener);

            // call to bootstrap topic list
            topicEventListener.HandleChildChange(ZkUtils.BrokerTopicsPath, topics);
        }