Package com.taobao.metamorphosis.utils.ZkUtils

Examples of com.taobao.metamorphosis.utils.ZkUtils.ZKConfig


            }
            String zkRoot = "/meta";
            if (!com.taobao.gecko.core.util.StringUtils.isBlank(props.getProperty("zk.zkRoot"))) {
                zkRoot = props.getProperty("zk.zkRoot");
            }
            final ZKConfig rt =
                    new ZKConfig(zkRoot, props.getProperty("zk.zkConnect"), Integer.parseInt(props
                        .getProperty("zk.zkSessionTimeoutMs")), Integer.parseInt(props
                        .getProperty("zk.zkConnectionTimeoutMs")), Integer.parseInt(props
                        .getProperty("zk.zkSyncTimeMs")), zkEnable);

            return rt;
View Full Code Here


        this.remotingClient = this.mocksControl.createMock(RemotingClientWrapper.class);
        this.fetchManager = this.mocksControl.createMock(FetchManager.class);

        // this.diamondManager = new DefaultDiamondManager(null,
        // "metamorphosis.testZkConfig", (ManagerListener) null);
        this.zkConfig = new ZKConfig();// DiamondUtils.getZkConfig(this.diamondManager,
        // 10000);
        this.zkConfig.zkConnect = "localhost:2181";
        this.client =
                new ZkClient(this.zkConfig.zkConnect, this.zkConfig.zkSessionTimeoutMs,
                    this.zkConfig.zkConnectionTimeoutMs, new ZkUtils.StringSerializer());
View Full Code Here

        if (!StringUtil.empty(zkConnect)) {
            final int zkSessionTimeoutMs = Integer.parseInt(serverProperties.getProperty("zk.zkSessionTimeoutMs"));
            final int zkConnectionTimeoutMs =
                    Integer.parseInt(serverProperties.getProperty("zk.zkConnectionTimeoutMs"));
            final int zkSyncTimeMs = Integer.parseInt(serverProperties.getProperty("zk.zkSyncTimeMs"));
            return setZkRoot(new ZKConfig(zkConnect, zkSessionTimeoutMs, zkConnectionTimeoutMs, zkSyncTimeMs), zkRoot);
        }
        else {
            return null;
        }
    }
View Full Code Here

    public void setup() throws Exception {
        this.metaConfig = new MetaConfig();
        this.metaConfig.setBrokerId(this.brokerId);
        this.metaConfig.setHostName("localhost");
        this.metaConfig.setServerPort(8199);
        ZKConfig zkConfig = new ZKConfig();
        this.metaConfig.setZkConfig(zkConfig);
        this.broker = new MetaMorphosisBroker(this.metaConfig);
        this.subscribeHandler = new SubscribeHandler(this.broker);
        this.metaZookeeper = this.broker.getBrokerZooKeeper().getMetaZookeeper();
    }
View Full Code Here

*/

public class Help {
    public static MetaClientConfig initMetaConfig() {
        final MetaClientConfig metaClientConfig = new MetaClientConfig();
        final ZKConfig zkConfig = new ZKConfig();
        zkConfig.zkConnect = "127.0.0.1:2181";
        zkConfig.zkRoot = "/meta";
        metaClientConfig.setZkConfig(zkConfig);
        return metaClientConfig;
    }
View Full Code Here

     */
    private ZKConfig loadZkConfigFromDiamond() {
        Properties properties;
        try {
            properties = Utils.getResourceAsProperties("server.ini", "GBK");
            final ZKConfig zkConfig = new ZKConfig();
            if (StringUtils.isNotBlank(properties.getProperty("zk.zkConnect"))) {
                zkConfig.zkConnect = properties.getProperty("zk.zkConnect");
            }

            if (StringUtils.isNotBlank(properties.getProperty("zk.zkSessionTimeoutMs"))) {
View Full Code Here


    private void populateZookeeperConfig(final Ini conf) {
        final Section zkConf = conf.get("zookeeper");
        Set<String> configKeySet = zkConf.keySet();
        Set<String> validKeySet = new ZKConfig().getFieldSet();
        validKeySet.addAll(this.getFieldSet());
        this.checkConfigKeys(configKeySet, validKeySet);
        if (!StringUtils.isBlank(zkConf.get("zk.zkConnect"))) {
            this.newZkConfigIfNull();
            this.zkConfig.zkConnect = zkConf.get("zk.zkConnect");
View Full Code Here

    }


    private void newZkConfigIfNull() {
        if (this.zkConfig == null) {
            this.zkConfig = new ZKConfig();
        }
    }
View Full Code Here

     */
    public void verify() {
        if (this.getTopics().isEmpty()) {
            throw new MetamorphosisServerStartupException("Empty topics list");
        }
        ZKConfig zkconfig = this.zkConfig;
        if (zkconfig == null) {
            throw new IllegalStateException("Null zookeeper config");
        }
        if (StringUtils.isBlank(this.zkConfig.zkConnect)) {
            throw new IllegalArgumentException("Empty zookeeper servers");
View Full Code Here

import com.taobao.metamorphosis.utils.ZkUtils.ZKConfig;

public class MessageConsumerTest {
  public static void main(String[] args) throws Exception{
    MetaClientConfig config = new MetaClientConfig();
    ZKConfig zkConfig = new ZKConfig("10.249.197.121", 30000, 30000, 5000);
    config.setZkConfig(zkConfig);
    MetaMessageSessionFactory factory = new MetaMessageSessionFactory(config);
    String topic = "test";
    String group = "pingwei";
    ConsumerConfig consumerConfig = new ConsumerConfig(group);
View Full Code Here

TOP

Related Classes of com.taobao.metamorphosis.utils.ZkUtils.ZKConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.