org.apache.rocketmq.store.CommitLogDispatcher Java Examples

The following examples show how to use org.apache.rocketmq.store.CommitLogDispatcher. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MessageStoreWithFilterTest.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
protected DefaultMessageStore gen(ConsumerFilterManager filterManager) throws Exception {
    MessageStoreConfig messageStoreConfig = buildStoreConfig(
        commitLogFileSize, cqFileSize, true, cqExtFileSize
    );

    BrokerConfig brokerConfig = new BrokerConfig();
    brokerConfig.setEnableCalcFilterBitMap(true);
    brokerConfig.setMaxErrorRateOfBloomFilter(20);
    brokerConfig.setExpectConsumerNumUseFilter(64);

    DefaultMessageStore master = new DefaultMessageStore(
        messageStoreConfig,
        new BrokerStatsManager(brokerConfig.getBrokerClusterName()),
        new MessageArrivingListener() {
            @Override
            public void arriving(String topic, int queueId, long logicOffset, long tagsCode,
                                 long msgStoreTime, byte[] filterBitMap, Map<String, String> properties) {
            }
        }
        , brokerConfig);

    master.getDispatcherList().addFirst(new CommitLogDispatcher() {
        @Override
        public void dispatch(DispatchRequest request) {
            try {
            } catch (Throwable e) {
                e.printStackTrace();
            }
        }
    });
    master.getDispatcherList().addFirst(new CommitLogDispatcherCalcBitMap(brokerConfig, filterManager));

    assertThat(master.load()).isTrue();

    master.start();

    return master;
}
 
Example #2
Source File: MessageStoreWithFilterTest.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
protected DefaultMessageStore gen(ConsumerFilterManager filterManager) throws Exception {
    MessageStoreConfig messageStoreConfig = buildStoreConfig(
        commitLogFileSize, cqFileSize, true, cqExtFileSize
    );

    BrokerConfig brokerConfig = new BrokerConfig();
    brokerConfig.setEnableCalcFilterBitMap(true);
    brokerConfig.setMaxErrorRateOfBloomFilter(20);
    brokerConfig.setExpectConsumerNumUseFilter(64);

    DefaultMessageStore master = new DefaultMessageStore(
        messageStoreConfig,
        new BrokerStatsManager(brokerConfig.getBrokerClusterName()),
        new MessageArrivingListener() {
            @Override
            public void arriving(String topic, int queueId, long logicOffset, long tagsCode,
                                 long msgStoreTime, byte[] filterBitMap, Map<String, String> properties) {
            }
        }
        , brokerConfig);

    master.getDispatcherList().addFirst(new CommitLogDispatcher() {
        @Override
        public void dispatch(DispatchRequest request) {
            try {
            } catch (Throwable e) {
                e.printStackTrace();
            }
        }
    });
    master.getDispatcherList().addFirst(new CommitLogDispatcherCalcBitMap(brokerConfig, filterManager));

    assertThat(master.load()).isTrue();

    master.start();

    return master;
}
 
Example #3
Source File: MessageStoreWithFilterTest.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
protected DefaultMessageStore gen(ConsumerFilterManager filterManager) throws Exception {
    MessageStoreConfig messageStoreConfig = buildStoreConfig(
        commitLogFileSize, cqFileSize, true, cqExtFileSize
    );

    BrokerConfig brokerConfig = new BrokerConfig();
    brokerConfig.setEnableCalcFilterBitMap(true);
    brokerConfig.setMaxErrorRateOfBloomFilter(20);
    brokerConfig.setExpectConsumerNumUseFilter(64);

    DefaultMessageStore master = new DefaultMessageStore(
        messageStoreConfig,
        new BrokerStatsManager(brokerConfig.getBrokerClusterName()),
        new MessageArrivingListener() {
            @Override
            public void arriving(String topic, int queueId, long logicOffset, long tagsCode,
                                 long msgStoreTime, byte[] filterBitMap, Map<String, String> properties) {
            }
        }
        , brokerConfig);

    master.getDispatcherList().addFirst(new CommitLogDispatcher() {
        @Override
        public void dispatch(DispatchRequest request) {
            try {
            } catch (Throwable e) {
                e.printStackTrace();
            }
        }
    });
    master.getDispatcherList().addFirst(new CommitLogDispatcherCalcBitMap(brokerConfig, filterManager));

    assertThat(master.load()).isTrue();

    master.start();

    return master;
}
 
Example #4
Source File: MessageStoreWithFilterTest.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
protected DefaultMessageStore gen(ConsumerFilterManager filterManager) throws Exception {
    MessageStoreConfig messageStoreConfig = buildStoreConfig(
        commitLogFileSize, cqFileSize, true, cqExtFileSize
    );

    BrokerConfig brokerConfig = new BrokerConfig();
    brokerConfig.setEnableCalcFilterBitMap(true);
    brokerConfig.setMaxErrorRateOfBloomFilter(20);
    brokerConfig.setExpectConsumerNumUseFilter(64);

    DefaultMessageStore master = new DefaultMessageStore(
        messageStoreConfig,
        new BrokerStatsManager(brokerConfig.getBrokerClusterName()),
        new MessageArrivingListener() {
            @Override
            public void arriving(String topic, int queueId, long logicOffset, long tagsCode,
                                 long msgStoreTime, byte[] filterBitMap, Map<String, String> properties) {
            }
        }
        , brokerConfig);

    master.getDispatcherList().addFirst(new CommitLogDispatcher() {
        @Override
        public void dispatch(DispatchRequest request) {
            try {
            } catch (Throwable e) {
                e.printStackTrace();
            }
        }
    });
    master.getDispatcherList().addFirst(new CommitLogDispatcherCalcBitMap(brokerConfig, filterManager));

    assertThat(master.load()).isTrue();

    master.start();

    return master;
}
 
Example #5
Source File: MessageStoreWithFilterTest.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
protected DefaultMessageStore gen(ConsumerFilterManager filterManager) throws Exception {
    MessageStoreConfig messageStoreConfig = buildStoreConfig(
        commitLogFileSize, cqFileSize, true, cqExtFileSize
    );

    BrokerConfig brokerConfig = new BrokerConfig();
    brokerConfig.setEnableCalcFilterBitMap(true);
    brokerConfig.setMaxErrorRateOfBloomFilter(20);
    brokerConfig.setExpectConsumerNumUseFilter(64);

    DefaultMessageStore master = new DefaultMessageStore(
        messageStoreConfig,
        new BrokerStatsManager(brokerConfig.getBrokerClusterName()),
        new MessageArrivingListener() {
            @Override
            public void arriving(String topic, int queueId, long logicOffset, long tagsCode,
                                 long msgStoreTime, byte[] filterBitMap, Map<String, String> properties) {
            }
        }
        , brokerConfig);

    master.getDispatcherList().addFirst(new CommitLogDispatcher() {
        @Override
        public void dispatch(DispatchRequest request) {
            try {
            } catch (Throwable e) {
                e.printStackTrace();
            }
        }
    });
    master.getDispatcherList().addFirst(new CommitLogDispatcherCalcBitMap(brokerConfig, filterManager));

    assertThat(master.load()).isTrue();

    master.start();

    return master;
}
 
Example #6
Source File: AbstractPluginMessageStore.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
@Override
public LinkedList<CommitLogDispatcher> getDispatcherList() {
    return next.getDispatcherList();
}
 
Example #7
Source File: AbstractPluginMessageStore.java    From rocketmq-4.3.0 with Apache License 2.0 4 votes vote down vote up
@Override
public LinkedList<CommitLogDispatcher> getDispatcherList() {
    return next.getDispatcherList();
}
 
Example #8
Source File: AbstractPluginMessageStore.java    From rocketmq-read with Apache License 2.0 4 votes vote down vote up
@Override
public LinkedList<CommitLogDispatcher> getDispatcherList() {
    return next.getDispatcherList();
}
 
Example #9
Source File: AbstractPluginMessageStore.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
@Override
public LinkedList<CommitLogDispatcher> getDispatcherList() {
    return next.getDispatcherList();
}
 
Example #10
Source File: AbstractPluginMessageStore.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 4 votes vote down vote up
@Override
public LinkedList<CommitLogDispatcher> getDispatcherList() {
    return next.getDispatcherList();
}
 
Example #11
Source File: MessageStoreWithFilterTest.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 4 votes vote down vote up
protected DefaultMessageStore gen(ConsumerFilterManager filterManager) throws Exception {
        MessageStoreConfig messageStoreConfig = buildStoreConfig(
            commitLogFileSize, cqFileSize, true, cqExtFileSize
        );

        BrokerConfig brokerConfig = new BrokerConfig();
        brokerConfig.setEnableCalcFilterBitMap(true);
        brokerConfig.setMaxErrorRateOfBloomFilter(20);
        brokerConfig.setExpectConsumerNumUseFilter(64);

        DefaultMessageStore master = new DefaultMessageStore(
            messageStoreConfig,
            new BrokerStatsManager(brokerConfig.getBrokerClusterName()),
            new MessageArrivingListener() {
                @Override
                public void arriving(String topic, int queueId, long logicOffset, long tagsCode,
                                     long msgStoreTime, byte[] filterBitMap, Map<String, String> properties) {
//                    System.out.println(String.format("Msg coming: %s, %d, %d, %d",
//                        topic, queueId, logicOffset, tagsCode));
                }
            }
            , brokerConfig);

        master.getDispatcherList().addFirst(new CommitLogDispatcher() {
            @Override
            public void dispatch(DispatchRequest request) {
                try {
//                    System.out.println(String.format("offset:%d, bitMap:%s", request.getCommitLogOffset(),
//                        BitsArray.create(request.getBitMap()).toString()));
                } catch (Throwable e) {
                    e.printStackTrace();
                }
            }
        });
        master.getDispatcherList().addFirst(new CommitLogDispatcherCalcBitMap(brokerConfig, filterManager));

        assertThat(master.load()).isTrue();

        master.start();

        return master;
    }
 
Example #12
Source File: AbstractPluginMessageStore.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
@Override
public LinkedList<CommitLogDispatcher> getDispatcherList() {
    return next.getDispatcherList();
}