com.alibaba.rocketmq.store.DefaultMessageStore Java Examples

The following examples show how to use com.alibaba.rocketmq.store.DefaultMessageStore. 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: AdminBrokerProcessor.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
private RemotingCommand getAllDelayOffset(ChannelHandlerContext ctx, RemotingCommand request) {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);

    String content = ((DefaultMessageStore) this.brokerController.getMessageStore()).getScheduleMessageService().encode();
    if (content != null && content.length() > 0) {
        try {
            response.setBody(content.getBytes(MixAll.DEFAULT_CHARSET));
        } catch (UnsupportedEncodingException e) {
            log.error("get all delay offset from master error.", e);

            response.setCode(ResponseCode.SYSTEM_ERROR);
            response.setRemark("UnsupportedEncodingException " + e);
            return response;
        }
    } else {
        log.error("No delay offset in this broker, client: " + ctx.channel().remoteAddress());
        response.setCode(ResponseCode.SYSTEM_ERROR);
        response.setRemark("No delay offset in this broker");
        return response;
    }

    response.setCode(ResponseCode.SUCCESS);
    response.setRemark(null);

    return response;
}
 
Example #2
Source File: AdminBrokerProcessor.java    From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 5 votes vote down vote up
private RemotingCommand getAllDelayOffset(ChannelHandlerContext ctx, RemotingCommand request) {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);

    String content = ((DefaultMessageStore) this.brokerController.getMessageStore()).getScheduleMessageService().encode();
    if (content != null && content.length() > 0) {
        try {
            response.setBody(content.getBytes(MixAll.DEFAULT_CHARSET));
        }
        catch (UnsupportedEncodingException e) {
            log.error("get all delay offset from master error.", e);

            response.setCode(ResponseCode.SYSTEM_ERROR);
            response.setRemark("UnsupportedEncodingException " + e);
            return response;
        }
    }
    else {
        log.error("No delay offset in this broker, client: " + ctx.channel().remoteAddress());
        response.setCode(ResponseCode.SYSTEM_ERROR);
        response.setRemark("No delay offset in this broker");
        return response;
    }

    response.setCode(ResponseCode.SUCCESS);
    response.setRemark(null);

    return response;
}
 
Example #3
Source File: HAService.java    From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 5 votes vote down vote up
public HAService(final DefaultMessageStore defaultMessageStore) throws IOException {
    this.defaultMessageStore = defaultMessageStore;
    this.acceptSocketService =
            new AcceptSocketService(defaultMessageStore.getMessageStoreConfig().getHaListenPort());
    this.groupTransferService = new GroupTransferService();
    this.haClient = new HAClient();
}
 
Example #4
Source File: IndexService.java    From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 5 votes vote down vote up
public IndexService(final DefaultMessageStore store) {
    this.defaultMessageStore = store;
    this.hashSlotNum = store.getMessageStoreConfig().getMaxHashSlotNum();
    this.indexNum = store.getMessageStoreConfig().getMaxIndexNum();
    this.storePath =
            StorePathConfigHelper.getStorePathIndex(store.getMessageStoreConfig().getStorePathRootDir());
}
 
Example #5
Source File: TransactionStateService.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public TransactionStateService(final DefaultMessageStore defaultMessageStore) {
    this.defaultMessageStore = defaultMessageStore;
    this.tranStateTable =
            new MapedFileQueue(defaultMessageStore.getMessageStoreConfig().getTranStateTableStorePath(),
                defaultMessageStore.getMessageStoreConfig().getTranStateTableMapedFileSize(), null);

    this.tranRedoLog = new ConsumeQueue(//
        TRANSACTION_REDOLOG_TOPIC,//
        TRANSACTION_REDOLOG_TOPIC_QUEUEID,//
        defaultMessageStore.getMessageStoreConfig().getTranRedoLogStorePath(),//
        defaultMessageStore.getMessageStoreConfig().getTranRedoLogMapedFileSize(),//
        defaultMessageStore);
}
 
Example #6
Source File: HAService.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public HAService(final DefaultMessageStore defaultMessageStore) throws IOException {
    this.defaultMessageStore = defaultMessageStore;
    this.acceptSocketService =
            new AcceptSocketService(defaultMessageStore.getMessageStoreConfig().getHaListenPort());
    this.groupTransferService = new GroupTransferService();
    this.haClient = new HAClient();
}
 
Example #7
Source File: IndexService.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public IndexService(final DefaultMessageStore store) {
    this.defaultMessageStore = store;
    this.hashSlotNum = store.getMessageStoreConfig().getMaxHashSlotNum();
    this.indexNum = store.getMessageStoreConfig().getMaxIndexNum();
    this.storePath =
            StorePathConfigHelper.getStorePathIndex(store.getMessageStoreConfig().getStorePathRootDir());
}
 
Example #8
Source File: AdminBrokerProcessor.java    From RocketMQ-Master-analyze with Apache License 2.0 5 votes vote down vote up
private RemotingCommand getAllDelayOffset(ChannelHandlerContext ctx, RemotingCommand request) {
    final RemotingCommand response = RemotingCommand.createResponseCommand(null);

    String content = ((DefaultMessageStore) this.brokerController.getMessageStore())
        .getScheduleMessageService().encode();
    if (content != null && content.length() > 0) {
        try {
            response.setBody(content.getBytes(MixAll.DEFAULT_CHARSET));
        }
        catch (UnsupportedEncodingException e) {
            log.error("get all delay offset from master error.", e);

            response.setCode(ResponseCode.SYSTEM_ERROR);
            response.setRemark("UnsupportedEncodingException " + e);
            return response;
        }
    }
    else {
        log.error("No delay offset in this broker, client: " + ctx.channel().remoteAddress());
        response.setCode(ResponseCode.SYSTEM_ERROR);
        response.setRemark("No delay offset in this broker");
        return response;
    }

    response.setCode(ResponseCode.SUCCESS);
    response.setRemark(null);

    return response;
}
 
Example #9
Source File: HAService.java    From RocketMQ-Master-analyze with Apache License 2.0 5 votes vote down vote up
public HAService(final DefaultMessageStore defaultMessageStore) throws IOException {
    this.defaultMessageStore = defaultMessageStore;
    this.acceptSocketService =
            new AcceptSocketService(defaultMessageStore.getMessageStoreConfig().getHaListenPort());
    this.groupTransferService = new GroupTransferService();
    this.haClient = new HAClient();
}
 
Example #10
Source File: IndexService.java    From RocketMQ-Master-analyze with Apache License 2.0 5 votes vote down vote up
public IndexService(final DefaultMessageStore store) {
    this.defaultMessageStore = store;
    this.hashSlotNum = store.getMessageStoreConfig().getMaxHashSlotNum();
    this.indexNum = store.getMessageStoreConfig().getMaxIndexNum();
    this.storePath =
            StorePathConfigHelper.getStorePathIndex(store.getMessageStoreConfig().getStorePathRootDir());
}
 
Example #11
Source File: HAService.java    From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 4 votes vote down vote up
public DefaultMessageStore getDefaultMessageStore() {
    return defaultMessageStore;
}
 
Example #12
Source File: BrokerStats.java    From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 4 votes vote down vote up
public BrokerStats(DefaultMessageStore defaultMessageStore) {
    this.defaultMessageStore = defaultMessageStore;
}
 
Example #13
Source File: HAService.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
public DefaultMessageStore getDefaultMessageStore() {
    return defaultMessageStore;
}
 
Example #14
Source File: BrokerStats.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
public BrokerStats(DefaultMessageStore defaultMessageStore) {
    this.defaultMessageStore = defaultMessageStore;
}
 
Example #15
Source File: HAService.java    From RocketMQ-Master-analyze with Apache License 2.0 4 votes vote down vote up
public DefaultMessageStore getDefaultMessageStore() {
    return defaultMessageStore;
}
 
Example #16
Source File: BrokerStats.java    From RocketMQ-Master-analyze with Apache License 2.0 4 votes vote down vote up
public BrokerStats(DefaultMessageStore defaultMessageStore) {
    this.defaultMessageStore = defaultMessageStore;
}