Java Code Examples for com.alibaba.rocketmq.store.config.MessageStoreConfig#setMessageIndexEnable()
The following examples show how to use
com.alibaba.rocketmq.store.config.MessageStoreConfig#setMessageIndexEnable() .
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: RecoverTest.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 5 votes |
public void writeMessage(boolean normal, boolean first) throws Exception { System.out.println("================================================================"); long totalMsgs = 1000; QUEUE_TOTAL = 3; MessageBody = StoreMessage.getBytes(); MessageStoreConfig messageStoreConfig = new MessageStoreConfig(); messageStoreConfig.setMapedFileSizeCommitLog(1024 * 32); messageStoreConfig.setMapedFileSizeConsumeQueue(100 * 20); messageStoreConfig.setMessageIndexEnable(false); MessageStore messageStore = new DefaultMessageStore(messageStoreConfig, null, null, null); if (first) { this.storeWrite1 = messageStore; } else { this.storeWrite2 = messageStore; } boolean loadResult = messageStore.load(); assertTrue(loadResult); messageStore.start(); for (long i = 0; i < totalMsgs; i++) { PutMessageResult result = messageStore.putMessage(buildMessage()); System.out.println(i + "\t" + result.getAppendMessageResult().getMsgId()); } if (normal) { messageStore.shutdown(); } System.out.println("========================writeMessage OK========================================"); }
Example 2
Source File: RecoverTest.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 5 votes |
public void readMessage(final long msgCnt) throws Exception { System.out.println("================================================================"); QUEUE_TOTAL = 3; MessageBody = StoreMessage.getBytes(); MessageStoreConfig messageStoreConfig = new MessageStoreConfig(); messageStoreConfig.setMapedFileSizeCommitLog(1024 * 32); messageStoreConfig.setMapedFileSizeConsumeQueue(100 * 20); messageStoreConfig.setMessageIndexEnable(false); storeRead = new DefaultMessageStore(messageStoreConfig, null, null, null); boolean loadResult = storeRead.load(); assertTrue(loadResult); storeRead.start(); long readCnt = 0; for (int queueId = 0; queueId < QUEUE_TOTAL; queueId++) { for (long offset = 0;;) { GetMessageResult result = storeRead.getMessage("GROUP_A", "TOPIC_A", queueId, offset, 1024 * 1024, null); if (result.getStatus() == GetMessageStatus.FOUND) { System.out.println(queueId + "\t" + result.getMessageCount()); this.veryReadMessage(queueId, offset, result.getMessageBufferList()); offset += result.getMessageCount(); readCnt += result.getMessageCount(); result.release(); } else { break; } } } System.out.println("readCnt = " + readCnt); assertTrue(readCnt == msgCnt); System.out.println("========================readMessage OK========================================"); }
Example 3
Source File: RecoverTest.java From rocketmq with Apache License 2.0 | 4 votes |
public void readMessage(final long msgCnt) throws Exception { System.out.println("================================================================"); QUEUE_TOTAL = 3; MessageBody = StoreMessage.getBytes(); MessageStoreConfig messageStoreConfig = new MessageStoreConfig(); messageStoreConfig.setMapedFileSizeCommitLog(1024 * 32); messageStoreConfig.setMapedFileSizeConsumeQueue(100 * 20); messageStoreConfig.setMessageIndexEnable(false); storeRead = new DefaultMessageStore(messageStoreConfig, null,null, null, null); boolean loadResult = storeRead.load(); assertTrue(loadResult); storeRead.start(); long readCnt = 0; for (int queueId = 0; queueId < QUEUE_TOTAL; queueId++) { for (long offset = 0; ; ) { GetMessageResult result = storeRead.getMessage("GROUP_A", "TOPIC_A", queueId, offset, 1024 * 1024, null); if (result.getStatus() == GetMessageStatus.FOUND) { System.out.println(queueId + "\t" + result.getMessageCount()); this.veryReadMessage(queueId, offset, result.getMessageBufferList()); offset += result.getMessageCount(); readCnt += result.getMessageCount(); result.release(); } else { break; } } } System.out.println("readCnt = " + readCnt); assertTrue(readCnt == msgCnt); System.out.println("========================readMessage OK========================================"); }
Example 4
Source File: RecoverTest.java From RocketMQ-Master-analyze with Apache License 2.0 | 4 votes |
public void writeMessage(boolean normal, boolean first) throws Exception { System.out.println("================================================================"); long totalMsgs = 1000; QUEUE_TOTAL = 3; // 构造消息体 MessageBody = StoreMessage.getBytes(); MessageStoreConfig messageStoreConfig = new MessageStoreConfig(); // 每个物理映射文件 messageStoreConfig.setMapedFileSizeCommitLog(1024 * 32); // 每个逻辑映射文件 messageStoreConfig.setMapedFileSizeConsumeQueue(100 * 20); messageStoreConfig.setMessageIndexEnable(false); MessageStore messageStore = new DefaultMessageStore(messageStoreConfig, null); if (first) { this.storeWrite1 = messageStore; } else { this.storeWrite2 = messageStore; } // 第一步,load已有数据 boolean loadResult = messageStore.load(); assertTrue(loadResult); // 第二步,启动服务 messageStore.start(); // 第三步,发消息 for (long i = 0; i < totalMsgs; i++) { PutMessageResult result = messageStore.putMessage(buildMessage()); System.out.println(i + "\t" + result.getAppendMessageResult().getMsgId()); } if (normal) { // 关闭存储服务 messageStore.shutdown(); } System.out.println("========================writeMessage OK========================================"); }
Example 5
Source File: RecoverTest.java From RocketMQ-Master-analyze with Apache License 2.0 | 4 votes |
public void readMessage(final long msgCnt) throws Exception { System.out.println("================================================================"); QUEUE_TOTAL = 3; // 构造消息体 MessageBody = StoreMessage.getBytes(); MessageStoreConfig messageStoreConfig = new MessageStoreConfig(); // 每个物理映射文件 messageStoreConfig.setMapedFileSizeCommitLog(1024 * 32); // 每个逻辑映射文件 messageStoreConfig.setMapedFileSizeConsumeQueue(100 * 20); messageStoreConfig.setMessageIndexEnable(false); storeRead = new DefaultMessageStore(messageStoreConfig, null); // 第一步,load已有数据 boolean loadResult = storeRead.load(); assertTrue(loadResult); // 第二步,启动服务 storeRead.start(); // 第三步,收消息 long readCnt = 0; for (int queueId = 0; queueId < QUEUE_TOTAL; queueId++) { for (long offset = 0;;) { GetMessageResult result = storeRead.getMessage("GROUP_A", "TOPIC_A", queueId, offset, 1024 * 1024, null); if (result.getStatus() == GetMessageStatus.FOUND) { System.out.println(queueId + "\t" + result.getMessageCount()); this.veryReadMessage(queueId, offset, result.getMessageBufferList()); offset += result.getMessageCount(); readCnt += result.getMessageCount(); result.release(); } else { break; } } } System.out.println("readCnt = " + readCnt); assertTrue(readCnt == msgCnt); System.out.println("========================readMessage OK========================================"); }
Example 6
Source File: RecoverTest.java From rocketmq with Apache License 2.0 | 2 votes |
public void writeMessage(boolean normal, boolean first) throws Exception { System.out.println("================================================================"); long totalMsgs = 1000; QUEUE_TOTAL = 3; MessageBody = StoreMessage.getBytes(); MessageStoreConfig messageStoreConfig = new MessageStoreConfig(); messageStoreConfig.setMapedFileSizeCommitLog(1024 * 32); messageStoreConfig.setMapedFileSizeConsumeQueue(100 * 20); messageStoreConfig.setMessageIndexEnable(false); MessageStore messageStore = new DefaultMessageStore(messageStoreConfig, null, null, null, null); if (first) { this.storeWrite1 = messageStore; } else { this.storeWrite2 = messageStore; } boolean loadResult = messageStore.load(); assertTrue(loadResult); messageStore.start(); for (long i = 0; i < totalMsgs; i++) { PutMessageResult result = messageStore.putMessage(buildMessage()); System.out.println(i + "\t" + result.getAppendMessageResult().getMsgId()); } if (normal) { messageStore.shutdown(); } System.out.println("========================writeMessage OK========================================"); }