Java Code Examples for org.apache.rocketmq.store.config.MessageStoreConfig#setMapedFileSizeConsumeQueue()

The following examples show how to use org.apache.rocketmq.store.config.MessageStoreConfig#setMapedFileSizeConsumeQueue() . 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: DefaultMessageStoreTest.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test(expected = OverlappingFileLockException.class)
public void test_repate_restart() throws Exception {
    long totalMsgs = 100;
    QUEUE_TOTAL = 1;
    MessageBody = StoreMessage.getBytes();

    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(1024 * 8);
    messageStoreConfig.setMapedFileSizeConsumeQueue(1024 * 4);
    messageStoreConfig.setMaxHashSlotNum(100);
    messageStoreConfig.setMaxIndexNum(100 * 10);
    MessageStore master = new DefaultMessageStore(messageStoreConfig, null, new MyMessageArrivingListener(), new BrokerConfig());

    boolean load = master.load();
    assertTrue(load);

    try {
        master.start();
        master.start();
    } finally {
        master.shutdown();
        master.destroy();
    }
}
 
Example 2
Source File: DefaultMessageStoreTest.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
@Test(expected = OverlappingFileLockException.class)
public void test_repate_restart() throws Exception {
    QUEUE_TOTAL = 1;
    MessageBody = StoreMessage.getBytes();

    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(1024 * 8);
    messageStoreConfig.setMapedFileSizeConsumeQueue(1024 * 4);
    messageStoreConfig.setMaxHashSlotNum(100);
    messageStoreConfig.setMaxIndexNum(100 * 10);
    MessageStore master = new DefaultMessageStore(messageStoreConfig, null, new MyMessageArrivingListener(), new BrokerConfig());

    boolean load = master.load();
    assertTrue(load);

    try {
        master.start();
        master.start();
    } finally {
        master.shutdown();
        master.destroy();
    }
}
 
Example 3
Source File: DefaultMessageStoreTest.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test(expected = OverlappingFileLockException.class)
public void test_repate_restart() throws Exception {
    long totalMsgs = 100;
    QUEUE_TOTAL = 1;
    MessageBody = StoreMessage.getBytes();

    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(1024 * 8);
    messageStoreConfig.setMapedFileSizeConsumeQueue(1024 * 4);
    messageStoreConfig.setMaxHashSlotNum(100);
    messageStoreConfig.setMaxIndexNum(100 * 10);
    MessageStore master = new DefaultMessageStore(messageStoreConfig, null, new MyMessageArrivingListener(), new BrokerConfig());

    boolean load = master.load();
    assertTrue(load);

    try {
        master.start();
        master.start();
    } finally {
        master.shutdown();
        master.destroy();
    }
}
 
Example 4
Source File: DefaultMessageStoreTest.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
@Test(expected = OverlappingFileLockException.class)
public void test_repate_restart() throws Exception {
    QUEUE_TOTAL = 1;
    MessageBody = StoreMessage.getBytes();

    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(1024 * 8);
    messageStoreConfig.setMapedFileSizeConsumeQueue(1024 * 4);
    messageStoreConfig.setMaxHashSlotNum(100);
    messageStoreConfig.setMaxIndexNum(100 * 10);
    MessageStore master = new DefaultMessageStore(messageStoreConfig, null, new MyMessageArrivingListener(), new BrokerConfig());

    boolean load = master.load();
    assertTrue(load);

    try {
        master.start();
        master.start();
    } finally {
        master.shutdown();
        master.destroy();
    }
}
 
Example 5
Source File: DefaultMessageStoreTest.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
@Test
public void testWriteAndRead() throws Exception {
    long totalMsgs = 100;
    QUEUE_TOTAL = 1;
    MessageBody = StoreMessage.getBytes();

    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(1024 * 8);
    messageStoreConfig.setMapedFileSizeConsumeQueue(1024 * 4);
    messageStoreConfig.setMaxHashSlotNum(100);
    messageStoreConfig.setMaxIndexNum(100 * 10);
    MessageStore master = new DefaultMessageStore(messageStoreConfig, null, new MyMessageArrivingListener(), new BrokerConfig());

    boolean load = master.load();
    assertTrue(load);

    master.start();
    try {
        for (long i = 0; i < totalMsgs; i++) {
            master.putMessage(buildMessage());
        }

        for (long i = 0; i < totalMsgs; i++) {
            GetMessageResult result = master.getMessage("GROUP_A", "TOPIC_A", 0, i, 1024 * 1024, null);
            assertThat(result).isNotNull();
            result.release();
        }
    } finally {
        master.shutdown();
        master.destroy();
    }
}
 
Example 6
Source File: ConsumeQueueTest.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public MessageStoreConfig buildStoreConfig(int commitLogFileSize, int cqFileSize,
    boolean enableCqExt, int cqExtFileSize) {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(commitLogFileSize);
    messageStoreConfig.setMapedFileSizeConsumeQueue(cqFileSize);
    messageStoreConfig.setMappedFileSizeConsumeQueueExt(cqExtFileSize);
    messageStoreConfig.setMessageIndexEnable(false);
    messageStoreConfig.setEnableConsumeQueueExt(enableCqExt);

    messageStoreConfig.setStorePathRootDir(storePath);
    messageStoreConfig.setStorePathCommitLog(storePath + File.separator + "commitlog");

    return messageStoreConfig;
}
 
Example 7
Source File: MessageStoreWithFilterTest.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
public MessageStoreConfig buildStoreConfig(int commitLogFileSize, int cqFileSize,
                                           boolean enableCqExt, int cqExtFileSize) {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(commitLogFileSize);
    messageStoreConfig.setMapedFileSizeConsumeQueue(cqFileSize);
    messageStoreConfig.setMappedFileSizeConsumeQueueExt(cqExtFileSize);
    messageStoreConfig.setMessageIndexEnable(false);
    messageStoreConfig.setEnableConsumeQueueExt(enableCqExt);

    messageStoreConfig.setStorePathRootDir(storePath);
    messageStoreConfig.setStorePathCommitLog(storePath + File.separator + "commitlog");

    return messageStoreConfig;
}
 
Example 8
Source File: DefaultMessageStoreShuwDownTest.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public DefaultMessageStore buildMessageStore() throws Exception {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(1024 * 1024 * 10);
    messageStoreConfig.setMapedFileSizeConsumeQueue(1024 * 1024 * 10);
    messageStoreConfig.setMaxHashSlotNum(10000);
    messageStoreConfig.setMaxIndexNum(100 * 100);
    messageStoreConfig.setFlushDiskType(FlushDiskType.SYNC_FLUSH);
    return new DefaultMessageStore(messageStoreConfig, new BrokerStatsManager("simpleTest"), null, new BrokerConfig());
}
 
Example 9
Source File: DefaultMessageStoreTest.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
private MessageStore buildMessageStore() throws Exception {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(1024 * 1024 * 10);
    messageStoreConfig.setMapedFileSizeConsumeQueue(1024 * 1024 * 10);
    messageStoreConfig.setMaxHashSlotNum(10000);
    messageStoreConfig.setMaxIndexNum(100 * 100);
    messageStoreConfig.setFlushDiskType(FlushDiskType.SYNC_FLUSH);
    messageStoreConfig.setFlushIntervalConsumeQueue(1);
    return new DefaultMessageStore(messageStoreConfig, new BrokerStatsManager("simpleTest"), new MyMessageArrivingListener(), new BrokerConfig());
}
 
Example 10
Source File: DefaultMessageStoreShutDownTest.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
public DefaultMessageStore buildMessageStore() throws Exception {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(1024 * 1024 * 10);
    messageStoreConfig.setMapedFileSizeConsumeQueue(1024 * 1024 * 10);
    messageStoreConfig.setMaxHashSlotNum(10000);
    messageStoreConfig.setMaxIndexNum(100 * 100);
    messageStoreConfig.setFlushDiskType(FlushDiskType.SYNC_FLUSH);
    return new DefaultMessageStore(messageStoreConfig, new BrokerStatsManager("simpleTest"), null, new BrokerConfig());
}
 
Example 11
Source File: DefaultMessageStoreTest.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public MessageStore buildMessageStore() throws Exception {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(1024 * 1024 * 10);
    messageStoreConfig.setMapedFileSizeConsumeQueue(1024 * 1024 * 10);
    messageStoreConfig.setMaxHashSlotNum(10000);
    messageStoreConfig.setMaxIndexNum(100 * 100);
    messageStoreConfig.setFlushDiskType(FlushDiskType.SYNC_FLUSH);
    return new DefaultMessageStore(messageStoreConfig, new BrokerStatsManager("simpleTest"), new MyMessageArrivingListener(), new BrokerConfig());
}
 
Example 12
Source File: DefaultMessageStoreTest.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
@Test
public void testWriteAndRead() throws Exception {
    long totalMsgs = 100;
    QUEUE_TOTAL = 1;
    MessageBody = StoreMessage.getBytes();

    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(1024 * 8);
    messageStoreConfig.setMapedFileSizeConsumeQueue(1024 * 4);
    messageStoreConfig.setMaxHashSlotNum(100);
    messageStoreConfig.setMaxIndexNum(100 * 10);
    MessageStore master = new DefaultMessageStore(messageStoreConfig, null, new MyMessageArrivingListener(), new BrokerConfig(), null);

    boolean load = master.load();
    assertTrue(load);

    master.start();
    try {
        for (long i = 0; i < totalMsgs; i++) {
            master.putMessage(buildMessage());
        }

        for (long i = 0; i < totalMsgs; i++) {
            GetMessageResult result = master.getMessage("GROUP_A", "TOPIC_A", 0, i, 1024 * 1024, null);
            assertThat(result).isNotNull();
            result.release();
        }
    } finally {
        master.shutdown();
        master.destroy();
    }
}
 
Example 13
Source File: MessageStoreWithFilterTest.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
public MessageStoreConfig buildStoreConfig(int commitLogFileSize, int cqFileSize,
                                           boolean enableCqExt, int cqExtFileSize) {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(commitLogFileSize);
    messageStoreConfig.setMapedFileSizeConsumeQueue(cqFileSize);
    messageStoreConfig.setMappedFileSizeConsumeQueueExt(cqExtFileSize);
    messageStoreConfig.setMessageIndexEnable(false);
    messageStoreConfig.setEnableConsumeQueueExt(enableCqExt);

    messageStoreConfig.setStorePathRootDir(storePath);
    messageStoreConfig.setStorePathCommitLog(storePath + File.separator + "commitlog");

    return messageStoreConfig;
}
 
Example 14
Source File: MessageStoreWithFilterTest.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public MessageStoreConfig buildStoreConfig(int commitLogFileSize, int cqFileSize,
                                           boolean enableCqExt, int cqExtFileSize) {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(commitLogFileSize);
    messageStoreConfig.setMapedFileSizeConsumeQueue(cqFileSize);
    messageStoreConfig.setMappedFileSizeConsumeQueueExt(cqExtFileSize);
    messageStoreConfig.setMessageIndexEnable(false);
    messageStoreConfig.setEnableConsumeQueueExt(enableCqExt);

    messageStoreConfig.setStorePathRootDir(storePath);
    messageStoreConfig.setStorePathCommitLog(storePath + File.separator + "commitlog");

    return messageStoreConfig;
}
 
Example 15
Source File: MessageStoreWithFilterTest.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
public MessageStoreConfig buildStoreConfig(int commitLogFileSize, int cqFileSize,
                                           boolean enableCqExt, int cqExtFileSize) {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(commitLogFileSize);
    messageStoreConfig.setMapedFileSizeConsumeQueue(cqFileSize);
    messageStoreConfig.setMappedFileSizeConsumeQueueExt(cqExtFileSize);
    messageStoreConfig.setMessageIndexEnable(false);
    messageStoreConfig.setEnableConsumeQueueExt(enableCqExt);

    messageStoreConfig.setStorePathRootDir(storePath);
    messageStoreConfig.setStorePathCommitLog(storePath + File.separator + "commitlog");

    return messageStoreConfig;
}
 
Example 16
Source File: DefaultMessageStoreShutDownTest.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
public DefaultMessageStore buildMessageStore() throws Exception {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(1024 * 1024 * 10);
    messageStoreConfig.setMapedFileSizeConsumeQueue(1024 * 1024 * 10);
    messageStoreConfig.setMaxHashSlotNum(10000);
    messageStoreConfig.setMaxIndexNum(100 * 100);
    messageStoreConfig.setFlushDiskType(FlushDiskType.SYNC_FLUSH);
    return new DefaultMessageStore(messageStoreConfig, new BrokerStatsManager("simpleTest"), null, new BrokerConfig());
}
 
Example 17
Source File: AppendCallbackTest.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
@Before
public void init() throws Exception {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(1024 * 8);
    messageStoreConfig.setMapedFileSizeConsumeQueue(1024 * 4);
    messageStoreConfig.setMaxHashSlotNum(100);
    messageStoreConfig.setMaxIndexNum(100 * 10);
    messageStoreConfig.setStorePathRootDir(System.getProperty("user.home") + File.separator + "unitteststore");
    messageStoreConfig.setStorePathCommitLog(System.getProperty("user.home") + File.separator + "unitteststore" + File.separator + "commitlog");
    //too much reference
    DefaultMessageStore messageStore = new DefaultMessageStore(messageStoreConfig, null, null, null);
    CommitLog commitLog = new CommitLog(messageStore);
    callback = commitLog.new DefaultAppendMessageCallback(1024);
}
 
Example 18
Source File: DefaultMessageStoreTest.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public MessageStore buildMessageStore() throws Exception {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(1024 * 1024 * 10);
    messageStoreConfig.setMapedFileSizeConsumeQueue(1024 * 1024 * 10);
    messageStoreConfig.setMaxHashSlotNum(10000);
    messageStoreConfig.setMaxIndexNum(100 * 100);
    messageStoreConfig.setFlushDiskType(FlushDiskType.SYNC_FLUSH);
    return new DefaultMessageStore(messageStoreConfig, new BrokerStatsManager("simpleTest"), new MyMessageArrivingListener(), new BrokerConfig());
}
 
Example 19
Source File: DefaultMessageStoreShuwDownTest.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public DefaultMessageStore buildMessageStore() throws Exception {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(1024 * 1024 * 10);
    messageStoreConfig.setMapedFileSizeConsumeQueue(1024 * 1024 * 10);
    messageStoreConfig.setMaxHashSlotNum(10000);
    messageStoreConfig.setMaxIndexNum(100 * 100);
    messageStoreConfig.setFlushDiskType(FlushDiskType.SYNC_FLUSH);
    return new DefaultMessageStore(messageStoreConfig, new BrokerStatsManager("simpleTest"), null, new BrokerConfig());
}
 
Example 20
Source File: MessageStoreWithFilterTest.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public MessageStoreConfig buildStoreConfig(int commitLogFileSize, int cqFileSize,
                                           boolean enableCqExt, int cqExtFileSize) {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(commitLogFileSize);
    messageStoreConfig.setMapedFileSizeConsumeQueue(cqFileSize);
    messageStoreConfig.setMappedFileSizeConsumeQueueExt(cqExtFileSize);
    messageStoreConfig.setMessageIndexEnable(false);
    messageStoreConfig.setEnableConsumeQueueExt(enableCqExt);

    messageStoreConfig.setStorePathRootDir(storePath);
    messageStoreConfig.setStorePathCommitLog(storePath + File.separator + "commitlog");

    return messageStoreConfig;
}