com.taobao.metamorphosis.client.producer
类 ProducerZooKeeper

java.lang.Object
  继承者 com.taobao.metamorphosis.client.producer.ProducerZooKeeper
所有已实现的接口:
ZkClientChangedListener

public class ProducerZooKeeper
extends Object
implements ZkClientChangedListener

Producer和zk的交互

作者:
boyan

嵌套类摘要
static interface ProducerZooKeeper.BrokerChangeListener
          When producer broker list is changed, it will notify the this listener.
static class ProducerZooKeeper.BrokersInfo
           
 
构造方法摘要
ProducerZooKeeper(MetaZookeeper metaZookeeper, RemotingClientWrapper remotingClient, org.I0Itec.zkclient.ZkClient zkClient, MetaClientConfig metaClientConfig)
           
 
方法摘要
 void deregisterBrokerChangeListener(String topic, ProducerZooKeeper.BrokerChangeListener listener)
           
 void notifyBrokersChange(String topic)
           
 void onBrokerChange(String topic, ProducerZooKeeper.BrokerChangeListener listener)
           
 void onZkClientChanged(org.I0Itec.zkclient.ZkClient newClient)
          当新的zkClient建立的时候
 void publishTopic(String topic, Object ref)
           
 String selectBroker(String topic, Partition partition)
          根据partition寻找broker url
 Partition selectPartition(String topic, Message message, PartitionSelector partitionSelector)
          根据topic和message选择分区
 void setDefaultTopic(String topic, Object ref)
          设置默认topic并发布
 void unPublishTopic(String topic, Object ref)
           
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

ProducerZooKeeper

public ProducerZooKeeper(MetaZookeeper metaZookeeper,
                         RemotingClientWrapper remotingClient,
                         org.I0Itec.zkclient.ZkClient zkClient,
                         MetaClientConfig metaClientConfig)
方法详细信息

onBrokerChange

public void onBrokerChange(String topic,
                           ProducerZooKeeper.BrokerChangeListener listener)

deregisterBrokerChangeListener

public void deregisterBrokerChangeListener(String topic,
                                           ProducerZooKeeper.BrokerChangeListener listener)

notifyBrokersChange

public void notifyBrokersChange(String topic)

publishTopic

public void publishTopic(String topic,
                         Object ref)

unPublishTopic

public void unPublishTopic(String topic,
                           Object ref)

setDefaultTopic

public void setDefaultTopic(String topic,
                            Object ref)
设置默认topic并发布

参数:
topic -

selectBroker

public String selectBroker(String topic,
                           Partition partition)
根据partition寻找broker url

参数:
topic -
message -
返回:
选中的broker的url

selectPartition

public Partition selectPartition(String topic,
                                 Message message,
                                 PartitionSelector partitionSelector)
                          throws MetaClientException
根据topic和message选择分区

参数:
topic -
message -
返回:
选中的分区
抛出:
MetaClientException

onZkClientChanged

public void onZkClientChanged(org.I0Itec.zkclient.ZkClient newClient)
从接口 ZkClientChangedListener 复制的描述
当新的zkClient建立的时候

指定者:
接口 ZkClientChangedListener 中的 onZkClientChanged


Copyright © 2010–2013. All rights reserved.