Examples of TopicPartitionRegInfo


Examples of com.taobao.metamorphosis.client.consumer.TopicPartitionRegInfo

        this.mockLoadNullInitOffset("topic1", GROUP, new Partition("0-2"));
        this.mockLoadNullInitOffset("topic2", GROUP, new Partition("0-0"));
        // this.mockLoadNullInitOffset("topic2", GROUP, new
        // Partition("1-0"));��load����һ��master�ķ���
        this.mockFetchManagerRestart();
        this.mockAddFetchRequest(new FetchRequest(new Broker(0, "meta://localhost:0"), 0, new TopicPartitionRegInfo(
            "topic1", new Partition("0-0"), 0), 1024 * 1024));
        this.mockAddFetchRequest(new FetchRequest(new Broker(0, "meta://localhost:0"), 0, new TopicPartitionRegInfo(
            "topic1", new Partition("0-1"), 0), 1024 * 1024));
        this.mockAddFetchRequest(new FetchRequest(new Broker(0, "meta://localhost:0"), 0, new TopicPartitionRegInfo(
            "topic1", new Partition("0-2"), 0), 1024 * 1024));
        this.mockAddFetchRequest(new FetchRequest(new Broker(0, "meta://localhost:0"), 0, new TopicPartitionRegInfo(
            "topic2", new Partition("0-0"), 0), 1024 * 1024));
        // this.mockAddFetchRequest(new FetchRequest(new Broker(1,
        // "meta://localhost:1"), 0, new TopicPartitionRegInfo(
        // "topic2", new Partition("1-0"), 0), 1024 * 1024));��������һ��masterץȡ��Ϣ

 
View Full Code Here

Examples of com.taobao.metamorphosis.client.consumer.TopicPartitionRegInfo

        this.mockLoadNullInitOffset("topic1", GROUP, new Partition("0-0"));
        this.mockLoadNullInitOffset("topic1", GROUP, new Partition("0-1"));
        this.mockLoadNullInitOffset("topic1", GROUP, new Partition("0-2"));
        this.mockLoadNullInitOffset("topic2", GROUP, new Partition("0-0"));
        this.mockFetchManagerRestart();
        this.mockAddFetchRequest(new FetchRequest(new Broker(0, "meta://localhost:0"), 0, new TopicPartitionRegInfo(
            "topic1", new Partition("0-0"), 0), 1024 * 1024));
        this.mockAddFetchRequest(new FetchRequest(new Broker(0, "meta://localhost:0"), 0, new TopicPartitionRegInfo(
            "topic1", new Partition("0-1"), 0), 1024 * 1024));
        this.mockAddFetchRequest(new FetchRequest(new Broker(0, "meta://localhost:0"), 0, new TopicPartitionRegInfo(
            "topic1", new Partition("0-2"), 0), 1024 * 1024));
        this.mockAddFetchRequest(new FetchRequest(new Broker(0, "meta://localhost:0"), 0, new TopicPartitionRegInfo(
            "topic2", new Partition("0-0"), 0), 1024 * 1024));
        this.mocksControl.replay();

        ZkUtils.createEphemeralPath(this.client, this.metaZookeeper.brokerIdsPath + "/0/master", "meta://localhost:0");
        this.client.createEphemeral(this.metaZookeeper.brokerTopicsSubPath + "/topic1/0-m",
View Full Code Here

Examples of com.taobao.metamorphosis.client.consumer.TopicPartitionRegInfo

     */
    public MessageIterator get(final String topic, final Partition partition, final long offset, final int maxsize)
            throws MetaClientException, InterruptedException {
        this.checkRequest(topic, partition, offset, maxsize);
        final FetchRequest request =
                new FetchRequest(null, 0, new TopicPartitionRegInfo(topic, partition, offset), maxsize);
        return this.fetch(request, 10000, TimeUnit.MILLISECONDS);
    }
View Full Code Here

Examples of com.taobao.metamorphosis.client.consumer.TopicPartitionRegInfo

        HashMap<Partition, TopicPartitionRegInfo> partitionTopicInfo = this.topicRegistry.get(topic);
        if (partitionTopicInfo == null) {
            partitionTopicInfo = new HashMap<Partition, TopicPartitionRegInfo>();
            this.topicRegistry.put(topic, partitionTopicInfo);
        }
        TopicPartitionRegInfo topicPartitionRegInfo = this.offsetStorage.load(topic, this.config.getGroup(), partition);
        if (topicPartitionRegInfo == null) {
            // ��ʼ����ʱ��Ĭ��ʹ��0,TODO ���ܲ�������
            this.offsetStorage.initOffset(topic, this.config.getGroup(), partition, 0);// Long.MAX_VALUE
            topicPartitionRegInfo = new TopicPartitionRegInfo(topic, partition, 0);
        }
        partitionTopicInfo.put(partition, topicPartitionRegInfo);

        this.fetchManager.addFetchRequest(new FetchRequest(null, 0L, topicPartitionRegInfo, maxSize));
    }
View Full Code Here

Examples of com.taobao.metamorphosis.client.consumer.TopicPartitionRegInfo

        EasyMock.expect(this.broker.getStoreManager()).andReturn(this.storeManager);
        EasyMock.expect(this.storeManager.getMessageStore(topic, partition)).andReturn(this.store);
        EasyMock.expect(this.store.getSizeInBytes()).andReturn(555L).anyTimes();
        EasyMock.expect(this.store.getMinOffset()).andReturn(100L).once();
        this.mocksControl.replay();
        final TopicPartitionRegInfo info = this.slaveOffsetStorage.load(topic, "ss", new Partition(0, partition));
        this.mocksControl.verify();

        Assert.assertEquals(100L + 555L, info.getOffset().get());
        Assert.assertEquals(partition, info.getPartition().getPartition());
        Assert.assertEquals(topic, info.getTopic());
    }
View Full Code Here

Examples of com.taobao.metamorphosis.client.consumer.TopicPartitionRegInfo

        OpaqueGenerator.resetOpaque();
        final MetaConfig config = new MetaConfig();
        config.setSlaveConfig(new SlaveConfig(0, GROUP, 500, true));
        EasyMock.expect(this.broker.getMetaConfig()).andReturn(config);
        this.mocksControl.replay();
        final TopicPartitionRegInfo info = this.slaveOffsetStorage.load(topic, "ss", new Partition(0, partition));
        this.mocksControl.verify();

        Assert.assertEquals(555L, info.getOffset().get());
        Assert.assertEquals(partition, info.getPartition().getPartition());
        Assert.assertEquals(topic, info.getTopic());
    }
View Full Code Here

Examples of com.taobao.metamorphosis.client.consumer.TopicPartitionRegInfo

        OpaqueGenerator.resetOpaque();
        final MetaConfig config = new MetaConfig();
        config.setSlaveConfig(new SlaveConfig(0, GROUP, 500, true));
        EasyMock.expect(this.broker.getMetaConfig()).andReturn(config);
        this.mocksControl.replay();
        final TopicPartitionRegInfo info = this.slaveOffsetStorage.load(topic, "ss", new Partition(0, partition));
        this.mocksControl.verify();
        Assert.assertEquals(0L, info.getOffset().get());
        Assert.assertEquals(partition, info.getPartition().getPartition());
        Assert.assertEquals(topic, info.getTopic());
    }
View Full Code Here

Examples of com.taobao.metamorphosis.client.consumer.TopicPartitionRegInfo

        final String group = "test-grp";
        final Partition partition = new Partition("0-1");
        Collection<TopicPartitionRegInfo> infoList = new ArrayList<TopicPartitionRegInfo>();
        for (int i = 0; i < 3; i++) {
            final String topic = "test" + (i + 1);
            infoList.add(new TopicPartitionRegInfo(topic, partition, i));
        }
        this.offsetStorage.commitOffset(group, infoList);
        for (int i = 0; i < 3; i++) {
            final String topic = "test" + (i + 1);
            TopicPartitionRegInfo info = this.offsetStorage.load(topic, "test-grp", partition);
            assertEquals(topic, info.getTopic());
            assertEquals(partition, info.getPartition());
            assertEquals(i, info.getOffset().get());
            info.getOffset().set(i);
            infoList.add(info);
        }
        OffsetStorage newOffsetStorage = new LocalOffsetStorage();
        for (int i = 0; i < 3; i++) {
            final String topic = "test" + (i + 1);
            TopicPartitionRegInfo info = newOffsetStorage.load(topic, "test-grp", partition);
            assertEquals(topic, info.getTopic());
            assertEquals(partition, info.getPartition());
            assertEquals(i, info.getOffset().get());
            info.getOffset().set(i);
            infoList.add(info);
        }
        newOffsetStorage.close();

        assertTrue(this.file.exists());
View Full Code Here

Examples of com.taobao.metamorphosis.client.consumer.TopicPartitionRegInfo

        final String group = "test-grp";
        final Partition partition = new Partition("0-1");
        Collection<TopicPartitionRegInfo> infoList = new ArrayList<TopicPartitionRegInfo>();
        for (int i = 0; i < 3; i++) {
            final String topic = "test" + (i + 1);
            infoList.add(new TopicPartitionRegInfo(topic, partition, i));
        }
        this.offsetStorage.commitOffset(group, infoList);

        this.offsetStorage.close();
        this.offsetStorage = new LocalOffsetStorage();
        for (int i = 0; i < 3; i++) {
            final String topic = "test" + (i + 1);
            TopicPartitionRegInfo info = this.offsetStorage.load(topic, "test-grp", partition);
            assertEquals(topic, info.getTopic());
            assertEquals(partition, info.getPartition());
            assertEquals(i, info.getOffset().get());
            info.getOffset().set(i);
            infoList.add(info);
        }
    }
View Full Code Here

Examples of com.taobao.metamorphosis.client.consumer.TopicPartitionRegInfo

        final String group = "test-grp";
        final Partition partition = new Partition("0-1");
        Collection<TopicPartitionRegInfo> infoList = new ArrayList<TopicPartitionRegInfo>();
        for (int i = 0; i < 3; i++) {
            final String topic = "test" + (i + 1);
            infoList.add(new TopicPartitionRegInfo(topic, partition, i));
        }
        this.offsetStorage.commitOffset(group, infoList);
        this.offsetStorage.commitOffset(group, null);
        for (int i = 0; i < 3; i++) {
            final String topic = "test" + (i + 1);
            TopicPartitionRegInfo info = this.offsetStorage.load(topic, "test-grp", partition);
            assertEquals(topic, info.getTopic());
            assertEquals(partition, info.getPartition());
            assertEquals(i, info.getOffset().get());
            info.getOffset().set(i);
            infoList.add(info);
        }
        OffsetStorage newOffsetStorage = new LocalOffsetStorage();
        for (int i = 0; i < 3; i++) {
            final String topic = "test" + (i + 1);
            TopicPartitionRegInfo info = newOffsetStorage.load(topic, "test-grp", partition);
            assertEquals(topic, info.getTopic());
            assertEquals(partition, info.getPartition());
            assertEquals(i, info.getOffset().get());
            info.getOffset().set(i);
            infoList.add(info);
        }

        this.offsetStorage.commitOffset(group, Collections.EMPTY_LIST);
        for (int i = 0; i < 3; i++) {
            final String topic = "test" + (i + 1);
            TopicPartitionRegInfo info = newOffsetStorage.load(topic, "test-grp", partition);
            assertEquals(topic, info.getTopic());
            assertEquals(partition, info.getPartition());
            assertEquals(i, info.getOffset().get());
            info.getOffset().set(i);
            infoList.add(info);
        }
        newOffsetStorage.close();

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.