com.alibaba.rocketmq.tools.admin
接口 MQAdminExt

所有超级接口:
MQAdmin
所有已知实现类:
DefaultMQAdminExt, DefaultMQAdminExtImpl

public interface MQAdminExt
extends MQAdmin

MQ管理类接口,涉及所有与MQ管理相关的对外接口
包括Topic创建、订阅组创建、配置修改等

从以下版本开始:
2013-7-14

方法摘要
 boolean cleanExpiredConsumerQueue(String cluster)
          触发清理失效的消费队列
 boolean cleanExpiredConsumerQueueByAddr(String addr)
          触发指定的broker清理失效的消费队列
 void cloneGroupOffset(String srcGroup, String destGroup, String topic, boolean isOffline)
          克隆某一个组的消费进度到新的组
 ConsumeMessageDirectlyResult consumeMessageDirectly(String consumerGroup, String clientId, String msgId)
          向指定Consumer发送某条消息
 void createAndUpdateKvConfig(String namespace, String key, String value)
          在 namespace 上添加或者更新 KV 配置
 void createAndUpdateSubscriptionGroupConfig(String addr, SubscriptionGroupConfig config)
          向指定Broker创建或者更新订阅组配置
 void createAndUpdateTopicConfig(String addr, TopicConfig config)
          向指定Broker创建或者更新Topic配置
 void createOrUpdateOrderConf(String key, String value, boolean isCluster)
          创建或更新顺序消息的分区配置
 void deleteIpsByProjectGroup(String key)
          删除 project group 对应的所有 server ip
 void deleteKvConfig(String namespace, String key)
          删除 namespace 上的 KV 配置
 void deleteSubscriptionGroup(String addr, String groupName)
          删除 broker 上的 subscription group 信息
 void deleteTopicInBroker(Set<String> addrs, String topic)
          删除 broker 上的 topic 信息
 void deleteTopicInNameServer(Set<String> addrs, String topic)
          删除 broker 上的 topic 信息
 ClusterInfo examineBrokerClusterInfo()
          查看集群信息
 ConsumerConnection examineConsumerConnectionInfo(String consumerGroup)
          查看Consumer网络连接、订阅关系
 ConsumeStats examineConsumeStats(String consumerGroup)
          查询消费进度
 ConsumeStats examineConsumeStats(String consumerGroup, String topic)
           
 ProducerConnection examineProducerConnectionInfo(String producerGroup, String topic)
          查看Producer网络连接
 SubscriptionGroupConfig examineSubscriptionGroupConfig(String addr, String group)
          查询指定Broker的订阅组配置
 TopicConfig examineTopicConfig(String addr, String topic)
          查询指定Broker的Topic配置
 TopicRouteData examineTopicRouteInfo(String topic)
          查看Topic路由信息
 TopicStatsTable examineTopicStats(String topic)
          查询Topic Offset信息
 TopicList fetchAllTopicList()
          从Name Server获取所有Topic列表
 KVTable fetchBrokerRuntimeStats(String brokerAddr)
          获取Broker运行时数据
 ConsumerRunningInfo getConsumerRunningInfo(String consumerGroup, String clientId, boolean jstack)
          查询Consumer内存数据结构
 Map<String,Map<MessageQueue,Long>> getConsumeStatus(String topic, String group, String clientAddr)
          通过客户端查看消费者的消费情况
 String getIpsByProjectGroup(String projectGroup)
          通过 project 获取所有的 server ip 信息
 String getKVConfig(String namespace, String key)
          从Name Server获取一个配置项
 KVTable getKVListByNamespace(String namespace)
          获取指定Namespace下的所有kv
 List<String> getNameServerAddressList()
          获取Name Server地址列表
 String getProjectGroupByIp(String ip)
          通过 server ip 获取 project 信息
 List<MessageTrack> messageTrackDetail(MessageExt msg)
          查询消息被谁消费了
 void putKVConfig(String namespace, String key, String value)
          向Name Server增加一个配置项
 Set<QueueTimeSpan> queryConsumeTimeSpan(String topic, String group)
          根据 topic 和 group 获取消息的时间跨度
 GroupList queryTopicConsumeByWho(String topic)
          根据Topic查询被哪些订阅组消费
 Map<MessageQueue,Long> resetOffsetByTimestamp(String topic, String group, long timestamp, boolean isForce)
          按照时间回溯消费进度(客户端不需要重启)
 List<RollbackStats> resetOffsetByTimestampOld(String consumerGroup, String topic, long timestamp, boolean force)
          按照时间回溯消费进度(客户端需要重启)
 void resetOffsetNew(String consumerGroup, String topic, long timestamp)
          重置消费进度,无论Consumer是否在线,都可以执行。
 void shutdown()
           
 void start()
           
 void updateBrokerConfig(String brokerAddr, Properties properties)
          更新Broker配置
 BrokerStatsData ViewBrokerStatsData(String brokerAddr, String statsName, String statsKey)
          服务器统计数据输出
 int wipeWritePermOfBroker(String namesrvAddr, String brokerName)
          清除某个Broker的写权限,针对所有Name Server
 
从接口 com.alibaba.rocketmq.client.MQAdmin 继承的方法
createTopic, createTopic, earliestMsgStoreTime, maxOffset, minOffset, queryMessage, searchOffset, viewMessage
 

方法详细信息

start

void start()
           throws MQClientException
抛出:
MQClientException

shutdown

void shutdown()

updateBrokerConfig

void updateBrokerConfig(String brokerAddr,
                        Properties properties)
                        throws RemotingConnectException,
                               RemotingSendRequestException,
                               RemotingTimeoutException,
                               UnsupportedEncodingException,
                               InterruptedException,
                               MQBrokerException
更新Broker配置

参数:
brokerAddr -
properties -
抛出:
MQBrokerException
InterruptedException
UnsupportedEncodingException
RemotingTimeoutException
RemotingSendRequestException
RemotingConnectException

createAndUpdateTopicConfig

void createAndUpdateTopicConfig(String addr,
                                TopicConfig config)
                                throws RemotingException,
                                       MQBrokerException,
                                       InterruptedException,
                                       MQClientException
向指定Broker创建或者更新Topic配置

参数:
addr -
config -
抛出:
MQClientException
InterruptedException
MQBrokerException
RemotingException

createAndUpdateSubscriptionGroupConfig

void createAndUpdateSubscriptionGroupConfig(String addr,
                                            SubscriptionGroupConfig config)
                                            throws RemotingException,
                                                   MQBrokerException,
                                                   InterruptedException,
                                                   MQClientException
向指定Broker创建或者更新订阅组配置

参数:
addr -
config -
抛出:
MQClientException
InterruptedException
MQBrokerException
RemotingException

examineSubscriptionGroupConfig

SubscriptionGroupConfig examineSubscriptionGroupConfig(String addr,
                                                       String group)
查询指定Broker的订阅组配置

参数:
addr -
group -
返回:

examineTopicConfig

TopicConfig examineTopicConfig(String addr,
                               String topic)
查询指定Broker的Topic配置

参数:
addr -
topic -
返回:

examineTopicStats

TopicStatsTable examineTopicStats(String topic)
                                  throws RemotingException,
                                         MQClientException,
                                         InterruptedException,
                                         MQBrokerException
查询Topic Offset信息

参数:
topic -
返回:
抛出:
RemotingException
MQClientException
InterruptedException
MQBrokerException

fetchAllTopicList

TopicList fetchAllTopicList()
                            throws RemotingException,
                                   MQClientException,
                                   InterruptedException
从Name Server获取所有Topic列表

返回:
抛出:
InterruptedException
MQClientException
RemotingException

fetchBrokerRuntimeStats

KVTable fetchBrokerRuntimeStats(String brokerAddr)
                                throws RemotingConnectException,
                                       RemotingSendRequestException,
                                       RemotingTimeoutException,
                                       InterruptedException,
                                       MQBrokerException
获取Broker运行时数据

返回:
抛出:
MQBrokerException
InterruptedException
RemotingTimeoutException
RemotingSendRequestException
RemotingConnectException

examineConsumeStats

ConsumeStats examineConsumeStats(String consumerGroup)
                                 throws RemotingException,
                                        MQClientException,
                                        InterruptedException,
                                        MQBrokerException
查询消费进度

参数:
consumerGroup -
返回:
抛出:
InterruptedException
MQClientException
RemotingException
MQBrokerException

examineConsumeStats

ConsumeStats examineConsumeStats(String consumerGroup,
                                 String topic)
                                 throws RemotingException,
                                        MQClientException,
                                        InterruptedException,
                                        MQBrokerException
抛出:
RemotingException
MQClientException
InterruptedException
MQBrokerException

examineBrokerClusterInfo

ClusterInfo examineBrokerClusterInfo()
                                     throws InterruptedException,
                                            MQBrokerException,
                                            RemotingTimeoutException,
                                            RemotingSendRequestException,
                                            RemotingConnectException
查看集群信息

返回:
抛出:
InterruptedException
MQBrokerException
RemotingTimeoutException
RemotingSendRequestException
RemotingConnectException

examineTopicRouteInfo

TopicRouteData examineTopicRouteInfo(String topic)
                                     throws RemotingException,
                                            MQClientException,
                                            InterruptedException
查看Topic路由信息

参数:
topic -
返回:
抛出:
RemotingException
MQClientException
InterruptedException

examineConsumerConnectionInfo

ConsumerConnection examineConsumerConnectionInfo(String consumerGroup)
                                                 throws RemotingConnectException,
                                                        RemotingSendRequestException,
                                                        RemotingTimeoutException,
                                                        InterruptedException,
                                                        MQBrokerException,
                                                        RemotingException,
                                                        MQClientException
查看Consumer网络连接、订阅关系

参数:
consumerGroup -
返回:
抛出:
MQBrokerException
InterruptedException
RemotingTimeoutException
RemotingSendRequestException
RemotingConnectException
MQClientException
RemotingException

examineProducerConnectionInfo

ProducerConnection examineProducerConnectionInfo(String producerGroup,
                                                 String topic)
                                                 throws RemotingException,
                                                        MQClientException,
                                                        InterruptedException,
                                                        MQBrokerException
查看Producer网络连接

参数:
producerGroup -
topic -
返回:
抛出:
InterruptedException
MQClientException
RemotingException
MQBrokerException

getNameServerAddressList

List<String> getNameServerAddressList()
获取Name Server地址列表

返回:

wipeWritePermOfBroker

int wipeWritePermOfBroker(String namesrvAddr,
                          String brokerName)
                          throws RemotingCommandException,
                                 RemotingConnectException,
                                 RemotingSendRequestException,
                                 RemotingTimeoutException,
                                 InterruptedException,
                                 MQClientException
清除某个Broker的写权限,针对所有Name Server

参数:
brokerName -
返回:
返回清除了多少个topic
抛出:
MQClientException
InterruptedException
RemotingTimeoutException
RemotingSendRequestException
RemotingConnectException
RemotingCommandException

putKVConfig

void putKVConfig(String namespace,
                 String key,
                 String value)
向Name Server增加一个配置项

参数:
namespace -
key -
value -

getKVConfig

String getKVConfig(String namespace,
                   String key)
                   throws RemotingException,
                          MQClientException,
                          InterruptedException
从Name Server获取一个配置项

参数:
namespace -
key -
返回:
抛出:
RemotingException
MQClientException
InterruptedException

getKVListByNamespace

KVTable getKVListByNamespace(String namespace)
                             throws RemotingException,
                                    MQClientException,
                                    InterruptedException
获取指定Namespace下的所有kv

参数:
namespace -
返回:
抛出:
InterruptedException
MQClientException
RemotingException

deleteTopicInBroker

void deleteTopicInBroker(Set<String> addrs,
                         String topic)
                         throws RemotingException,
                                MQBrokerException,
                                InterruptedException,
                                MQClientException
删除 broker 上的 topic 信息

参数:
addrs -
topic -
抛出:
RemotingException
MQBrokerException
InterruptedException
MQClientException

deleteTopicInNameServer

void deleteTopicInNameServer(Set<String> addrs,
                             String topic)
                             throws RemotingException,
                                    MQBrokerException,
                                    InterruptedException,
                                    MQClientException
删除 broker 上的 topic 信息

参数:
addrs -
topic -
抛出:
RemotingException
MQBrokerException
InterruptedException
MQClientException

deleteSubscriptionGroup

void deleteSubscriptionGroup(String addr,
                             String groupName)
                             throws RemotingException,
                                    MQBrokerException,
                                    InterruptedException,
                                    MQClientException
删除 broker 上的 subscription group 信息

参数:
addr -
groupName -
抛出:
RemotingException
MQBrokerException
InterruptedException
MQClientException

createAndUpdateKvConfig

void createAndUpdateKvConfig(String namespace,
                             String key,
                             String value)
                             throws RemotingException,
                                    MQBrokerException,
                                    InterruptedException,
                                    MQClientException
在 namespace 上添加或者更新 KV 配置

参数:
namespace -
key -
value -
抛出:
RemotingException
MQBrokerException
InterruptedException
MQClientException

deleteKvConfig

void deleteKvConfig(String namespace,
                    String key)
                    throws RemotingException,
                           MQBrokerException,
                           InterruptedException,
                           MQClientException
删除 namespace 上的 KV 配置

参数:
namespace -
key -
抛出:
RemotingException
MQBrokerException
InterruptedException
MQClientException

getProjectGroupByIp

String getProjectGroupByIp(String ip)
                           throws RemotingException,
                                  MQBrokerException,
                                  InterruptedException,
                                  MQClientException
通过 server ip 获取 project 信息

参数:
ip -
返回:
抛出:
RemotingException
MQBrokerException
InterruptedException
MQClientException

getIpsByProjectGroup

String getIpsByProjectGroup(String projectGroup)
                            throws RemotingException,
                                   MQBrokerException,
                                   InterruptedException,
                                   MQClientException
通过 project 获取所有的 server ip 信息

参数:
projectGroup -
返回:
抛出:
RemotingException
MQBrokerException
InterruptedException
MQClientException

deleteIpsByProjectGroup

void deleteIpsByProjectGroup(String key)
                             throws RemotingException,
                                    MQBrokerException,
                                    InterruptedException,
                                    MQClientException
删除 project group 对应的所有 server ip

参数:
key -
抛出:
RemotingException
MQBrokerException
InterruptedException
MQClientException

resetOffsetByTimestampOld

List<RollbackStats> resetOffsetByTimestampOld(String consumerGroup,
                                              String topic,
                                              long timestamp,
                                              boolean force)
                                              throws RemotingException,
                                                     MQBrokerException,
                                                     InterruptedException,
                                                     MQClientException
按照时间回溯消费进度(客户端需要重启)

参数:
consumerGroup -
topic -
timestamp -
force -
返回:
抛出:
RemotingException
MQBrokerException
InterruptedException
MQClientException

resetOffsetByTimestamp

Map<MessageQueue,Long> resetOffsetByTimestamp(String topic,
                                              String group,
                                              long timestamp,
                                              boolean isForce)
                                              throws RemotingException,
                                                     MQBrokerException,
                                                     InterruptedException,
                                                     MQClientException
按照时间回溯消费进度(客户端不需要重启)

参数:
topic -
group -
timestamp -
isForce -
返回:
抛出:
RemotingException
MQBrokerException
InterruptedException
MQClientException

resetOffsetNew

void resetOffsetNew(String consumerGroup,
                    String topic,
                    long timestamp)
                    throws RemotingException,
                           MQBrokerException,
                           InterruptedException,
                           MQClientException
重置消费进度,无论Consumer是否在线,都可以执行。不保证最终结果是否成功,需要调用方通过消费进度查询来再次确认

参数:
consumerGroup -
topic -
timestamp -
抛出:
InterruptedException
MQBrokerException
RemotingException
MQClientException

getConsumeStatus

Map<String,Map<MessageQueue,Long>> getConsumeStatus(String topic,
                                                    String group,
                                                    String clientAddr)
                                                    throws RemotingException,
                                                           MQBrokerException,
                                                           InterruptedException,
                                                           MQClientException
通过客户端查看消费者的消费情况

参数:
topic -
group -
clientAddr -
返回:
抛出:
RemotingException
MQBrokerException
InterruptedException
MQClientException

createOrUpdateOrderConf

void createOrUpdateOrderConf(String key,
                             String value,
                             boolean isCluster)
                             throws RemotingException,
                                    MQBrokerException,
                                    InterruptedException,
                                    MQClientException
创建或更新顺序消息的分区配置

参数:
key -
value -
isCluster -
抛出:
RemotingException
MQBrokerException
InterruptedException
MQClientException

queryTopicConsumeByWho

GroupList queryTopicConsumeByWho(String topic)
                                 throws RemotingConnectException,
                                        RemotingSendRequestException,
                                        RemotingTimeoutException,
                                        InterruptedException,
                                        MQBrokerException,
                                        RemotingException,
                                        MQClientException
根据Topic查询被哪些订阅组消费

参数:
topic -
返回:
抛出:
MQBrokerException
InterruptedException
RemotingTimeoutException
RemotingSendRequestException
RemotingConnectException
MQClientException
RemotingException

queryConsumeTimeSpan

Set<QueueTimeSpan> queryConsumeTimeSpan(String topic,
                                        String group)
                                        throws InterruptedException,
                                               MQBrokerException,
                                               RemotingException,
                                               MQClientException
根据 topic 和 group 获取消息的时间跨度

参数:
topic -
group -
返回:
抛出:
RemotingConnectException
RemotingSendRequestException
RemotingTimeoutException
InterruptedException
MQBrokerException
RemotingException
MQClientException

cleanExpiredConsumerQueue

boolean cleanExpiredConsumerQueue(String cluster)
                                  throws RemotingConnectException,
                                         RemotingSendRequestException,
                                         RemotingTimeoutException,
                                         MQClientException,
                                         InterruptedException
触发清理失效的消费队列

参数:
cluster - null则表示所有集群
返回:
清理是否成功
抛出:
RemotingConnectException
RemotingSendRequestException
RemotingTimeoutException
MQClientException
InterruptedException

cleanExpiredConsumerQueueByAddr

boolean cleanExpiredConsumerQueueByAddr(String addr)
                                        throws RemotingConnectException,
                                               RemotingSendRequestException,
                                               RemotingTimeoutException,
                                               MQClientException,
                                               InterruptedException
触发指定的broker清理失效的消费队列

参数:
addr -
返回:
清理是否成功
抛出:
RemotingConnectException
RemotingSendRequestException
RemotingTimeoutException
MQClientException
InterruptedException

getConsumerRunningInfo

ConsumerRunningInfo getConsumerRunningInfo(String consumerGroup,
                                           String clientId,
                                           boolean jstack)
                                           throws RemotingException,
                                                  MQClientException,
                                                  InterruptedException
查询Consumer内存数据结构

参数:
consumerGroup -
clientId -
返回:
抛出:
InterruptedException
MQClientException
RemotingException

consumeMessageDirectly

ConsumeMessageDirectlyResult consumeMessageDirectly(String consumerGroup,
                                                    String clientId,
                                                    String msgId)
                                                    throws RemotingException,
                                                           MQClientException,
                                                           InterruptedException,
                                                           MQBrokerException
向指定Consumer发送某条消息

参数:
consumerGroup -
clientId -
msgId -
返回:
抛出:
InterruptedException
MQClientException
RemotingException
MQBrokerException

messageTrackDetail

List<MessageTrack> messageTrackDetail(MessageExt msg)
                                      throws RemotingException,
                                             MQClientException,
                                             InterruptedException,
                                             MQBrokerException
查询消息被谁消费了

参数:
msg -
返回:
抛出:
RemotingException
MQClientException
InterruptedException
MQBrokerException

cloneGroupOffset

void cloneGroupOffset(String srcGroup,
                      String destGroup,
                      String topic,
                      boolean isOffline)
                      throws RemotingException,
                             MQClientException,
                             InterruptedException,
                             MQBrokerException
克隆某一个组的消费进度到新的组

参数:
srcGroup -
destGroup -
topic -
isOffline -
抛出:
RemotingException
MQClientException
InterruptedException
MQBrokerException

ViewBrokerStatsData

BrokerStatsData ViewBrokerStatsData(String brokerAddr,
                                    String statsName,
                                    String statsKey)
                                    throws RemotingConnectException,
                                           RemotingSendRequestException,
                                           RemotingTimeoutException,
                                           MQClientException,
                                           InterruptedException
服务器统计数据输出

参数:
statsName -
statsKey -
返回:
抛出:
InterruptedException
MQClientException
RemotingTimeoutException
RemotingSendRequestException
RemotingConnectException


Copyright © 2012-2015. All Rights Reserved.