public interface MQAdmin
| 限定符和类型 | 方法和说明 |
|---|---|
void |
createTopic(String key,
String newTopic,
int queueNum)
创建topic
|
long |
earliestMsgStoreTime(MessageQueue mq)
向服务器查询队列保存的最早消息对应的存储时间
|
long |
maxOffset(MessageQueue mq)
向服务器查询队列最大Offset PS: 最大Offset无对应消息,减1有消息
|
long |
minOffset(MessageQueue mq)
向服务器查询队列最小Offset PS: 最小Offset有对应消息
|
QueryResult |
queryMessage(String topic,
String key,
int maxNum,
long begin,
long end)
根据消息Key查询消息
|
long |
searchOffset(MessageQueue mq,
long timestamp)
根据时间查询对应的offset,精确到毫秒
P.S. |
MessageExt |
viewMessage(String msgId)
根据消息ID,从服务器获取完整的消息
|
void createTopic(String key, String newTopic, int queueNum) throws MQClientException
key - 请向运维人员申请newTopic - 要创建的新topicqueueNum - 新topic队列数MQClientExceptionlong searchOffset(MessageQueue mq, long timestamp) throws MQClientException
mq - 队列timestamp - 毫秒形式时间戳MQClientExceptionlong maxOffset(MessageQueue mq) throws MQClientException
mq - 队列MQClientExceptionlong minOffset(MessageQueue mq) throws MQClientException
mq - 队列MQClientExceptionlong earliestMsgStoreTime(MessageQueue mq) throws MQClientException
mq - 队列MQClientExceptionMessageExt viewMessage(String msgId) throws com.alibaba.rocketmq.remoting.exception.RemotingException, MQBrokerException, InterruptedException, MQClientException
msgId - InterruptedExceptionMQBrokerExceptioncom.alibaba.rocketmq.remoting.exception.RemotingExceptionMQClientExceptionQueryResult queryMessage(String topic, String key, int maxNum, long begin, long end) throws MQClientException, InterruptedException
topic - 消息主题key - 消息关键词maxNum - 查询最大条数begin - 起始时间戳end - 结束时间戳MQClientExceptionInterruptedExceptionCopyright © 2012–2013. All rights reserved.