Package com.taobao.metamorphosis.client

Examples of com.taobao.metamorphosis.client.MetaClientConfig


* @since 2012-2-20 ����4:36:51
*/

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


    @Before
    public void setUp() throws Exception {
        FileUtils.deleteDirectory(new File(RecoverStorageManager.META_RECOVER_STORE_PATH));
        this.subscribeInfoManager = new SubscribeInfoManager();
        final MetaClientConfig metaClientConfig = new MetaClientConfig();
        metaClientConfig.setRecoverMessageIntervalInMills(1000);
        this.recoverStorageManager = new RecoverStorageManager(metaClientConfig, this.subscribeInfoManager);
        this.recoverStorageManager.start(metaClientConfig);
    }
View Full Code Here


    @Test
    public void testAppendShutdownLoadRecover() throws Exception {
        this.recoverStorageManager.shutdown();
        final MetaClientConfig metaClientConfig = new MetaClientConfig();
        metaClientConfig.setRecoverMessageIntervalInMills(Integer.MAX_VALUE);
        this.recoverStorageManager = new RecoverStorageManager(metaClientConfig, this.subscribeInfoManager);
        this.recoverStorageManager.start(metaClientConfig);
        final String group = "dennis";
        final BlockingQueue<Message> queue = new ArrayBlockingQueue<Message>(1024);
        this.subscribeInfoManager.subscribe("test", group, 1024 * 1024, new MessageListener() {

            @Override
            public void recieveMessages(final Message message) {
                queue.offer(message);
            }


            @Override
            public Executor getExecutor() {
                return null;
            }
        }, null);
        for (int i = 0; i < 100; i++) {
            final Message msg2 = new Message("test", ("hello" + i).getBytes());
            MessageAccessor.setId(msg2, i);
            this.recoverStorageManager.append(group, msg2);
        }
        this.recoverStorageManager.shutdown();

        // ��������������recover���Ϊ1��
        metaClientConfig.setRecoverMessageIntervalInMills(1000);
        this.recoverStorageManager = new RecoverStorageManager(metaClientConfig, this.subscribeInfoManager);
        this.recoverStorageManager.start(metaClientConfig);
        while (queue.size() < 100) {
            Thread.sleep(1000);
        }
View Full Code Here

    MetaClientConfig metaClientConfig;

    @Before
    public void setUp() throws Exception {
        this.metaClientConfig = new MetaClientConfig();
        this.sessionFactory = new MetaMessageSessionFactory(this.metaClientConfig);
        this.startServer("server1");
        System.out.println("before run");
    }
View Full Code Here

    public SubscribeHandler(final MetaMorphosisBroker broker) throws MetaClientException {
        this.broker = broker;
        this.slaveZooKeeper = new SlaveZooKeeper(this.broker, this);
        final MetaConfig metaConfig = this.broker.getMetaConfig();

        final MetaClientConfig metaClientConfig = new MetaClientConfig();
        metaClientConfig.setZkConfig(metaConfig.getZkConfig());
        this.sessionFactory = SlaveMetaMessageSessionFactory.create(metaClientConfig, metaConfig.getBrokerId());
        this.slaveOffsetStorage =
                new SlaveOffsetStorage(this.broker, this.slaveZooKeeper, this.sessionFactory.getRemotingClient());
        this.messageListener =
                new MetaSlaveListener(this.broker.getBrokerZooKeeper(), this.broker.getStoreManager(),
View Full Code Here


    @Before
    @Override
    public void setUp() throws Exception {
        final MetaClientConfig metaClientConfig = new MetaClientConfig();
        super.sessionFactory = new MetaMessageSessionFactory(metaClientConfig);
        this.log.info("before run");
    }
View Full Code Here

import com.taobao.metamorphosis.client.consumer.MessageListener;
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);
    MessageConsumer consumer = factory.createConsumer(consumerConfig);
View Full Code Here

import com.taobao.metamorphosis.client.producer.MessageProducer;
import com.taobao.metamorphosis.utils.ZkUtils.ZKConfig;

public class MessageSenderTest {
  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);
    MessageProducer producer = factory.createProducer(false);
    String topic = "test";
    producer.publish(topic);
    Message message = new Message(topic, new byte[128]);
View Full Code Here


    @Override
    @Before
    public void setUp() throws Exception {
        this.metaClientConfig = new MetaClientConfig();
        this.sessionFactory = new MetaMessageSessionFactory(this.metaClientConfig);
        this.startServer("server4");
        System.out.println("before run");
    }
View Full Code Here


    @Override
    @Before
    public void setUp() throws Exception {
        final MetaClientConfig metaClientConfig = new MetaClientConfig();
        this.sessionFactory = new MetaMessageSessionFactory(metaClientConfig);
        this.startServer("server3");
        System.out.println("before run");
    }
View Full Code Here

TOP

Related Classes of com.taobao.metamorphosis.client.MetaClientConfig

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.