org.apache.rocketmq.store.MessageArrivingListener Java Examples

The following examples show how to use org.apache.rocketmq.store.MessageArrivingListener. 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: MessageStorePluginContext.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public MessageStorePluginContext(MessageStoreConfig messageStoreConfig,
    BrokerStatsManager brokerStatsManager, MessageArrivingListener messageArrivingListener,
    BrokerConfig brokerConfig) {
    super();
    this.messageStoreConfig = messageStoreConfig;
    this.brokerStatsManager = brokerStatsManager;
    this.messageArrivingListener = messageArrivingListener;
    this.brokerConfig = brokerConfig;
}
 
Example #2
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 #3
Source File: MessageStorePluginContext.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public MessageStorePluginContext(MessageStoreConfig messageStoreConfig,
    BrokerStatsManager brokerStatsManager, MessageArrivingListener messageArrivingListener,
    BrokerConfig brokerConfig) {
    super();
    this.messageStoreConfig = messageStoreConfig;
    this.brokerStatsManager = brokerStatsManager;
    this.messageArrivingListener = messageArrivingListener;
    this.brokerConfig = brokerConfig;
}
 
Example #4
Source File: MessageStorePluginContext.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
public MessageStorePluginContext(MessageStoreConfig messageStoreConfig,
    BrokerStatsManager brokerStatsManager, MessageArrivingListener messageArrivingListener,
    BrokerConfig brokerConfig) {
    super();
    this.messageStoreConfig = messageStoreConfig;
    this.brokerStatsManager = brokerStatsManager;
    this.messageArrivingListener = messageArrivingListener;
    this.brokerConfig = brokerConfig;
}
 
Example #5
Source File: MessageStorePluginContext.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
public MessageStorePluginContext(MessageStoreConfig messageStoreConfig,
    BrokerStatsManager brokerStatsManager, MessageArrivingListener messageArrivingListener,
    BrokerConfig brokerConfig) {
    super();
    this.messageStoreConfig = messageStoreConfig;
    this.brokerStatsManager = brokerStatsManager;
    this.messageArrivingListener = messageArrivingListener;
    this.brokerConfig = brokerConfig;
}
 
Example #6
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 #7
Source File: MessageStorePluginContext.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public MessageStorePluginContext(MessageStoreConfig messageStoreConfig,
    BrokerStatsManager brokerStatsManager, MessageArrivingListener messageArrivingListener,
    BrokerConfig brokerConfig) {
    super();
    this.messageStoreConfig = messageStoreConfig;
    this.brokerStatsManager = brokerStatsManager;
    this.messageArrivingListener = messageArrivingListener;
    this.brokerConfig = brokerConfig;
}
 
Example #8
Source File: MessageStorePluginContext.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public MessageStorePluginContext(MessageStoreConfig messageStoreConfig,
    BrokerStatsManager brokerStatsManager, MessageArrivingListener messageArrivingListener,
    BrokerConfig brokerConfig) {
    super();
    this.messageStoreConfig = messageStoreConfig;
    this.brokerStatsManager = brokerStatsManager;
    this.messageArrivingListener = messageArrivingListener;
    this.brokerConfig = brokerConfig;
}
 
Example #9
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 #10
Source File: MessageStorePluginContext.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
public MessageStorePluginContext(MessageStoreConfig messageStoreConfig,
    BrokerStatsManager brokerStatsManager, MessageArrivingListener messageArrivingListener,
    BrokerConfig brokerConfig) {
    super();
    this.messageStoreConfig = messageStoreConfig;
    this.brokerStatsManager = brokerStatsManager;
    this.messageArrivingListener = messageArrivingListener;
    this.brokerConfig = brokerConfig;
}
 
Example #11
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 #12
Source File: MessageStorePluginContext.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
public MessageStorePluginContext(MessageStoreConfig messageStoreConfig,
    BrokerStatsManager brokerStatsManager, MessageArrivingListener messageArrivingListener,
    BrokerConfig brokerConfig) {
    super();
    this.messageStoreConfig = messageStoreConfig;
    this.brokerStatsManager = brokerStatsManager;
    this.messageArrivingListener = messageArrivingListener;
    this.brokerConfig = brokerConfig;
}
 
Example #13
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 #14
Source File: MessageStorePluginContext.java    From rocketmq-read with Apache License 2.0 4 votes vote down vote up
public MessageArrivingListener getMessageArrivingListener() {
    return messageArrivingListener;
}
 
Example #15
Source File: MessageStorePluginContext.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
public MessageArrivingListener getMessageArrivingListener() {
    return messageArrivingListener;
}
 
Example #16
Source File: MessageStorePluginContext.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
public MessageArrivingListener getMessageArrivingListener() {
    return messageArrivingListener;
}
 
Example #17
Source File: MessageStorePluginContext.java    From rocketmq-4.3.0 with Apache License 2.0 4 votes vote down vote up
public MessageArrivingListener getMessageArrivingListener() {
    return messageArrivingListener;
}
 
Example #18
Source File: MessageStorePluginContext.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 4 votes vote down vote up
public MessageArrivingListener getMessageArrivingListener() {
    return messageArrivingListener;
}
 
Example #19
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 #20
Source File: MessageStorePluginContext.java    From rocketmq_trans_message with Apache License 2.0 4 votes vote down vote up
public MessageArrivingListener getMessageArrivingListener() {
    return messageArrivingListener;
}
 
Example #21
Source File: MessageStorePluginContext.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
public MessageArrivingListener getMessageArrivingListener() {
    return messageArrivingListener;
}
 
Example #22
Source File: MessageStorePluginContext.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
public MessageArrivingListener getMessageArrivingListener() {
    return messageArrivingListener;
}