org.apache.rocketmq.remoting.exception.RemotingSendRequestException Java Examples

The following examples show how to use org.apache.rocketmq.remoting.exception.RemotingSendRequestException. 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: SendMsgStatusCommandTest.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException {
    mQClientAPIImpl = mock(MQClientAPIImpl.class);
    defaultMQAdminExt = new DefaultMQAdminExt();
    defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000);

    Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance");
    field.setAccessible(true);
    field.set(defaultMQAdminExtImpl, mqClientInstance);
    field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl");
    field.setAccessible(true);
    field.set(mqClientInstance, mQClientAPIImpl);
    field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl");
    field.setAccessible(true);
    field.set(defaultMQAdminExt, defaultMQAdminExtImpl);
}
 
Example #2
Source File: MQClientAPIImpl.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
public int wipeWritePermOfBroker(final String namesrvAddr, String brokerName,
    final long timeoutMillis) throws RemotingCommandException,
    RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException, InterruptedException, MQClientException {
    WipeWritePermOfBrokerRequestHeader requestHeader = new WipeWritePermOfBrokerRequestHeader();
    requestHeader.setBrokerName(brokerName);

    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.WIPE_WRITE_PERM_OF_BROKER, requestHeader);

    RemotingCommand response = this.remotingClient.invokeSync(namesrvAddr, request, timeoutMillis);
    assert response != null;
    switch (response.getCode()) {
        case ResponseCode.SUCCESS: {
            WipeWritePermOfBrokerResponseHeader responseHeader =
                (WipeWritePermOfBrokerResponseHeader) response.decodeCommandCustomHeader(WipeWritePermOfBrokerResponseHeader.class);
            return responseHeader.getWipeTopicCount();
        }
        default:
            break;
    }

    throw new MQClientException(response.getCode(), response.getRemark());
}
 
Example #3
Source File: MQClientAPIImpl.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
public TopicConfigSerializeWrapper getAllTopicConfig(final String addr,
    long timeoutMillis) throws RemotingConnectException,
    RemotingSendRequestException, RemotingTimeoutException, InterruptedException, MQBrokerException {
    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_ALL_TOPIC_CONFIG, null);

    RemotingCommand response = this.remotingClient.invokeSync(MixAll.brokerVIPChannel(this.clientConfig.isVipChannelEnabled(), addr),
        request, timeoutMillis);
    assert response != null;
    switch (response.getCode()) {
        case ResponseCode.SUCCESS: {
            return TopicConfigSerializeWrapper.decode(response.getBody(), TopicConfigSerializeWrapper.class);
        }
        default:
            break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 
Example #4
Source File: MQClientAPIImpl.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
public TopicStatsTable getTopicStatsInfo(final String addr, final String topic,
    final long timeoutMillis) throws InterruptedException,
    RemotingTimeoutException, RemotingSendRequestException, RemotingConnectException, MQBrokerException {
    GetTopicStatsInfoRequestHeader requestHeader = new GetTopicStatsInfoRequestHeader();
    requestHeader.setTopic(topic);

    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_TOPIC_STATS_INFO, requestHeader);

    RemotingCommand response = this.remotingClient.invokeSync(MixAll.brokerVIPChannel(this.clientConfig.isVipChannelEnabled(), addr),
        request, timeoutMillis);
    switch (response.getCode()) {
        case ResponseCode.SUCCESS: {
            TopicStatsTable topicStatsTable = TopicStatsTable.decode(response.getBody(), TopicStatsTable.class);
            return topicStatsTable;
        }
        default:
            break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 
Example #5
Source File: BrokerStatusSubCommandTest.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException {
    mQClientAPIImpl = mock(MQClientAPIImpl.class);
    defaultMQAdminExt = new DefaultMQAdminExt();
    defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000);

    Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance");
    field.setAccessible(true);
    field.set(defaultMQAdminExtImpl, mqClientInstance);
    field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl");
    field.setAccessible(true);
    field.set(mqClientInstance, mQClientAPIImpl);
    field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl");
    field.setAccessible(true);
    field.set(defaultMQAdminExt, defaultMQAdminExtImpl);

    KVTable kvTable = new KVTable();
    kvTable.setTable(new HashMap<String, String>());
    when(mQClientAPIImpl.getBrokerRuntimeInfo(anyString(), anyLong())).thenReturn(kvTable);
}
 
Example #6
Source File: MQClientAPIImpl.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
public List<QueueTimeSpan> queryConsumeTimeSpan(final String addr, final String topic, final String group,
    final long timeoutMillis)
    throws RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException, InterruptedException,
    MQBrokerException {
    QueryConsumeTimeSpanRequestHeader requestHeader = new QueryConsumeTimeSpanRequestHeader();
    requestHeader.setTopic(topic);
    requestHeader.setGroup(group);

    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.QUERY_CONSUME_TIME_SPAN, requestHeader);

    RemotingCommand response = this.remotingClient.invokeSync(MixAll.brokerVIPChannel(this.clientConfig.isVipChannelEnabled(), addr),
        request, timeoutMillis);
    switch (response.getCode()) {
        case ResponseCode.SUCCESS: {
            QueryConsumeTimeSpanBody consumeTimeSpanBody = GroupList.decode(response.getBody(), QueryConsumeTimeSpanBody.class);
            return consumeTimeSpanBody.getConsumeTimeSpanSet();
        }
        default:
            break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 
Example #7
Source File: BrokerConsumeStatsSubCommadTest.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException {
    mQClientAPIImpl = mock(MQClientAPIImpl.class);
    defaultMQAdminExt = new DefaultMQAdminExt();
    defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000);

    Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance");
    field.setAccessible(true);
    field.set(defaultMQAdminExtImpl, mqClientInstance);
    field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl");
    field.setAccessible(true);
    field.set(mqClientInstance, mQClientAPIImpl);
    field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl");
    field.setAccessible(true);
    field.set(defaultMQAdminExt, defaultMQAdminExtImpl);

    ConsumeStatsList consumeStatsList = new ConsumeStatsList();
    consumeStatsList.setBrokerAddr("127.0l.0.1:10911");
    consumeStatsList.setConsumeStatsList(new ArrayList<Map<String, List<ConsumeStats>>>());
    consumeStatsList.setTotalDiff(123);
    when(mQClientAPIImpl.fetchConsumeStatsInBroker(anyString(), anyBoolean(), anyLong())).thenReturn(consumeStatsList);
}
 
Example #8
Source File: MQClientAPIImpl.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
public KVTable getBrokerRuntimeInfo(final String addr, final long timeoutMillis) throws RemotingConnectException,
    RemotingSendRequestException, RemotingTimeoutException, InterruptedException, MQBrokerException {

    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_BROKER_RUNTIME_INFO, null);

    RemotingCommand response = this.remotingClient.invokeSync(MixAll.brokerVIPChannel(this.clientConfig.isVipChannelEnabled(), addr),
        request, timeoutMillis);
    switch (response.getCode()) {
        case ResponseCode.SUCCESS: {
            return KVTable.decode(response.getBody(), KVTable.class);
        }
        default:
            break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 
Example #9
Source File: MQClientAPIImpl.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
public BrokerStatsData viewBrokerStatsData(String brokerAddr, String statsName, String statsKey, long timeoutMillis)
    throws MQClientException, RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException,
    InterruptedException {
    ViewBrokerStatsDataRequestHeader requestHeader = new ViewBrokerStatsDataRequestHeader();
    requestHeader.setStatsName(statsName);
    requestHeader.setStatsKey(statsKey);

    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.VIEW_BROKER_STATS_DATA, requestHeader);

    RemotingCommand response = this.remotingClient
        .invokeSync(MixAll.brokerVIPChannel(this.clientConfig.isVipChannelEnabled(), brokerAddr), request, timeoutMillis);
    assert response != null;
    switch (response.getCode()) {
        case ResponseCode.SUCCESS: {
            byte[] body = response.getBody();
            if (body != null) {
                return BrokerStatsData.decode(body, BrokerStatsData.class);
            }
        }
        default:
            break;
    }

    throw new MQClientException(response.getCode(), response.getRemark());
}
 
Example #10
Source File: MQClientAPIImpl.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
public BrokerStatsData viewBrokerStatsData(String brokerAddr, String statsName, String statsKey, long timeoutMillis)
    throws MQClientException, RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException,
    InterruptedException {
    ViewBrokerStatsDataRequestHeader requestHeader = new ViewBrokerStatsDataRequestHeader();
    requestHeader.setStatsName(statsName);
    requestHeader.setStatsKey(statsKey);

    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.VIEW_BROKER_STATS_DATA, requestHeader);

    String acturallyAddr = getActurallyBrokerAddr(brokerAddr);
    RemotingCommand response = this.remotingClient
        .invokeSync(MixAll.brokerVIPChannel(this.clientConfig.isVipChannelEnabled(), acturallyAddr), request, timeoutMillis);
    assert response != null;
    switch (response.getCode()) {
        case ResponseCode.SUCCESS: {
            byte[] body = response.getBody();
            if (body != null) {
                return BrokerStatsData.decode(body, BrokerStatsData.class);
            }
        }
        default:
            break;
    }

    throw new MQClientException(response.getCode(), response.getRemark());
}
 
Example #11
Source File: GetBrokerConfigCommand.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
protected void getAndPrint(final MQAdminExt defaultMQAdminExt, final String printPrefix, final String addr)
    throws InterruptedException, RemotingConnectException,
    UnsupportedEncodingException, RemotingTimeoutException,
    MQBrokerException, RemotingSendRequestException {

    System.out.print(printPrefix);

    Properties properties = defaultMQAdminExt.getBrokerConfig(addr);
    if (properties == null) {
        System.out.printf("Broker[%s] has no config property!\n", addr);
        return;
    }

    for (Object key : properties.keySet()) {
        System.out.printf("%-50s=  %s\n", key, properties.get(key));
    }

    System.out.printf("%n");
}
 
Example #12
Source File: BrokerOuterAPI.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
/**
 * 获取全部的 SubscriptionGroupConfig
 * @param addr 主节点地址
 * @return ;
 * @throws InterruptedException ;
 * @throws RemotingTimeoutException ;
 * @throws RemotingSendRequestException ;
 * @throws RemotingConnectException ;
 * @throws MQBrokerException ;
 */
public SubscriptionGroupWrapper getAllSubscriptionGroupConfig(
    final String addr) throws InterruptedException, RemotingTimeoutException,

    RemotingSendRequestException, RemotingConnectException, MQBrokerException {
    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_ALL_SUBSCRIPTIONGROUP_CONFIG, null);
    RemotingCommand response = this.remotingClient.invokeSync(addr, request, 3000);
    assert response != null;
    switch (response.getCode()) {
        case ResponseCode.SUCCESS: {
            return SubscriptionGroupWrapper.decode(response.getBody(), SubscriptionGroupWrapper.class);
        }
        default:
            break;
    }

    throw new MQBrokerException(response.getCode(), response.getRemark());
}
 
Example #13
Source File: MQClientAPIImpl.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
public QueryConsumeQueueResponseBody queryConsumeQueue(final String brokerAddr, final String topic,
    final int queueId,
    final long index, final int count, final String consumerGroup,
    final long timeoutMillis) throws InterruptedException,
    RemotingTimeoutException, RemotingSendRequestException, RemotingConnectException, MQClientException {

    QueryConsumeQueueRequestHeader requestHeader = new QueryConsumeQueueRequestHeader();
    requestHeader.setTopic(topic);
    requestHeader.setQueueId(queueId);
    requestHeader.setIndex(index);
    requestHeader.setCount(count);
    requestHeader.setConsumerGroup(consumerGroup);

    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.QUERY_CONSUME_QUEUE, requestHeader);

    RemotingCommand response = this.remotingClient.invokeSync(MixAll.brokerVIPChannel(this.clientConfig.isVipChannelEnabled(), brokerAddr), request, timeoutMillis);

    assert response != null;

    if (ResponseCode.SUCCESS == response.getCode()) {
        return QueryConsumeQueueResponseBody.decode(response.getBody(), QueryConsumeQueueResponseBody.class);
    }

    throw new MQClientException(response.getCode(), response.getRemark());
}
 
Example #14
Source File: BrokerStatusSubCommand.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
public void printBrokerRuntimeStats(final DefaultMQAdminExt defaultMQAdminExt, final String brokerAddr,
    final boolean printBroker) throws InterruptedException, MQBrokerException, RemotingTimeoutException, RemotingSendRequestException, RemotingConnectException {
    KVTable kvTable = defaultMQAdminExt.fetchBrokerRuntimeStats(brokerAddr);

    TreeMap<String, String> tmp = new TreeMap<String, String>();
    tmp.putAll(kvTable.getTable());

    Iterator<Entry<String, String>> it = tmp.entrySet().iterator();
    while (it.hasNext()) {
        Entry<String, String> next = it.next();
        if (printBroker) {
            System.out.printf("%-24s %-32s: %s%n", brokerAddr, next.getKey(), next.getValue());
        } else {
            System.out.printf("%-32s: %s%n", next.getKey(), next.getValue());
        }
    }
}
 
Example #15
Source File: TlsTest.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
/**
 * Tests that a server configured to require client authentication actually does require client
 * authentication.
 */
@Test
public void noClientAuthFailure() throws Exception {
    try {
        RemotingCommand response = remotingClient.invokeSync("localhost:8888", createRequest(), 1000 * 3);
        failBecauseExceptionWasNotThrown(RemotingSendRequestException.class);
    } catch (RemotingSendRequestException ignore) {
    }
}
 
Example #16
Source File: DefaultMQAdminExt.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
@Override
public Map<String, Properties> getNameServerConfig(final List<String> nameServers)
    throws InterruptedException, RemotingTimeoutException,
    RemotingSendRequestException, RemotingConnectException, MQClientException,
    UnsupportedEncodingException {
    return this.defaultMQAdminExtImpl.getNameServerConfig(nameServers);
}
 
Example #17
Source File: TlsTest.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
/**
 * Tests that a client configured using GrpcSslContexts refuses to talk to a server that has an
 * an untrusted certificate.
 */
@Test
public void clientRejectsUntrustedServerCert() throws Exception {
    try {
        RemotingCommand response = remotingClient.invokeSync("localhost:8888", createRequest(), 1000 * 3);
        failBecauseExceptionWasNotThrown(RemotingSendRequestException.class);
    } catch (RemotingSendRequestException ignore) {
    }
}
 
Example #18
Source File: DefaultMQAdminExtImpl.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
@Override
public void updateNameServerConfig(final Properties properties, final List<String> nameServers)
    throws InterruptedException, RemotingConnectException,
    UnsupportedEncodingException, RemotingSendRequestException, RemotingTimeoutException,
    MQClientException, MQBrokerException {
    this.mqClientInstance.getMQClientAPIImpl().updateNameServerConfig(properties, nameServers, timeoutMillis);
}
 
Example #19
Source File: DefaultMQAdminExtTest.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
@Test
public void testUpdateBrokerConfig() throws InterruptedException, RemotingConnectException, UnsupportedEncodingException, RemotingTimeoutException, MQBrokerException, RemotingSendRequestException {
    Properties result = defaultMQAdminExt.getBrokerConfig("127.0.0.1:10911");
    assertThat(result.getProperty("maxMessageSize")).isEqualTo("5000000");
    assertThat(result.getProperty("flushDelayOffsetInterval")).isEqualTo("15000");
    assertThat(result.getProperty("serverSocketRcvBufSize")).isEqualTo("655350");
}
 
Example #20
Source File: TlsTest.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
@Test
public void serverRejectsSSLClient() throws Exception {
    try {
        RemotingCommand response = remotingClient.invokeSync("localhost:8888", createRequest(), 1000 * 5);
        failBecauseExceptionWasNotThrown(RemotingSendRequestException.class);
    } catch (RemotingSendRequestException ignore) {
    }
}
 
Example #21
Source File: DefaultMQAdminExtImpl.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public boolean cleanUnusedTopicByCluster(ClusterInfo clusterInfo, String cluster) throws RemotingConnectException,
    RemotingSendRequestException, RemotingTimeoutException, MQClientException, InterruptedException {
    boolean result = false;
    String[] addrs = clusterInfo.retrieveAllAddrByCluster(cluster);
    for (String addr : addrs) {
        result = cleanUnusedTopicByAddr(addr);
    }
    return result;
}
 
Example #22
Source File: TlsTest.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
/**
 * Tests that a client configured using GrpcSslContexts refuses to talk to a server that has an
 * an untrusted certificate.
 */
@Test
public void clientRejectsUntrustedServerCert() throws Exception {
    try {
        RemotingCommand response = remotingClient.invokeSync("localhost:8888", createRequest(), 1000 * 3);
        failBecauseExceptionWasNotThrown(RemotingSendRequestException.class);
    } catch (RemotingSendRequestException ignore) {
    }
}
 
Example #23
Source File: CommandUtil.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
public static Map<String/*master addr*/, List<String>/*slave addr*/> fetchMasterAndSlaveDistinguish(
    final MQAdminExt adminExt, final String clusterName)
    throws InterruptedException, RemotingConnectException,
    RemotingTimeoutException, RemotingSendRequestException,
    MQBrokerException {
    Map<String, List<String>> masterAndSlaveMap = new HashMap<String, List<String>>(4);

    ClusterInfo clusterInfoSerializeWrapper = adminExt.examineBrokerClusterInfo();
    Set<String> brokerNameSet = clusterInfoSerializeWrapper.getClusterAddrTable().get(clusterName);

    if (brokerNameSet == null) {
        System.out.printf("[error] %s", ERROR_MESSAGE);
        return masterAndSlaveMap;
    }

    for (String brokerName : brokerNameSet) {
        BrokerData brokerData = clusterInfoSerializeWrapper.getBrokerAddrTable().get(brokerName);

        if (brokerData == null || brokerData.getBrokerAddrs() == null) {
            continue;
        }

        String masterAddr = brokerData.getBrokerAddrs().get(MixAll.MASTER_ID);
        masterAndSlaveMap.put(masterAddr, new ArrayList<String>());

        for (Long id : brokerData.getBrokerAddrs().keySet()) {
            if (brokerData.getBrokerAddrs().get(id) == null || id == MixAll.MASTER_ID) {
                continue;
            }

            masterAndSlaveMap.get(masterAddr).add(brokerData.getBrokerAddrs().get(id));
        }
    }

    return masterAndSlaveMap;
}
 
Example #24
Source File: DefaultMQAdminExt.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Override
public Map<String, Properties> getNameServerConfig(final List<String> nameServers)
    throws InterruptedException, RemotingTimeoutException,
    RemotingSendRequestException, RemotingConnectException, MQClientException,
    UnsupportedEncodingException {
    return this.defaultMQAdminExtImpl.getNameServerConfig(nameServers);
}
 
Example #25
Source File: MQClientAPIImpl.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public void enableBrokerRoleSwitch(final String clusterName, final String brokerName,
    final List<String> nameServers) throws InterruptedException, RemotingTimeoutException, RemotingSendRequestException, RemotingConnectException, MQBrokerException, RemotingCommandException, MQClientException {
    List<String> invokeNameServers = (nameServers == null || nameServers.isEmpty()) ?
        this.remotingClient.getNameServerAddressList() : nameServers;
    if (invokeNameServers == null || invokeNameServers.isEmpty()) {
        return;
    }

    EnableBrokerRoleSwitchRequestHeader requestHeader = new EnableBrokerRoleSwitchRequestHeader();
    requestHeader.setClusterName(clusterName);
    requestHeader.setBrokerName(brokerName);

    RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.ENABLE_BROKER_ROLE_SWITCH, requestHeader);

    RemotingCommand errResponse = null;
    for (String namesrvAddr : invokeNameServers) {
        RemotingCommand response = this.remotingClient.invokeSync(namesrvAddr, request, 3000);
        assert response != null;
        switch (response.getCode()) {
            case ResponseCode.SUCCESS: {
                break;
            }
            default:
                errResponse = response;
        }
    }
    if (errResponse != null) {
        throw new MQClientException(errResponse.getCode(), errResponse.getRemark());
    }
}
 
Example #26
Source File: DefaultMQAdminExtImpl.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Override
public boolean cleanExpiredConsumerQueueByAddr(
    String addr) throws RemotingConnectException, RemotingSendRequestException,
    RemotingTimeoutException, MQClientException, InterruptedException {
    boolean result = mqClientInstance.getMQClientAPIImpl().cleanExpiredConsumeQueue(addr, timeoutMillis);
    log.warn("clean expired ConsumeQueue on target " + addr + " broker " + result);
    return result;
}
 
Example #27
Source File: DefaultMQAdminExtTest.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetAllSubscriptionGroup() throws InterruptedException, MQBrokerException, RemotingTimeoutException, RemotingSendRequestException, RemotingConnectException {
    SubscriptionGroupWrapper subscriptionGroupWrapper = defaultMQAdminExt.getAllSubscriptionGroup("127.0.0.1:10911", 10000);
    assertThat(subscriptionGroupWrapper.getSubscriptionGroupTable().get("Consumer-group-one").getBrokerId()).isEqualTo(1234);
    assertThat(subscriptionGroupWrapper.getSubscriptionGroupTable().get("Consumer-group-one").getGroupName()).isEqualTo("Consumer-group-one");
    assertThat(subscriptionGroupWrapper.getSubscriptionGroupTable().get("Consumer-group-one").isConsumeBroadcastEnable()).isTrue();
}
 
Example #28
Source File: DefaultMQAdminExt.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
@Override
public boolean cleanExpiredConsumerQueue(
    String cluster) throws RemotingConnectException, RemotingSendRequestException,
    RemotingTimeoutException, MQClientException, InterruptedException {
    return defaultMQAdminExtImpl.cleanExpiredConsumerQueue(cluster);
}
 
Example #29
Source File: Broker2Client.java    From rocketmq-4.3.0 with Apache License 2.0 4 votes vote down vote up
public RemotingCommand callClient(final Channel channel,
                                      final RemotingCommand request
    ) throws RemotingSendRequestException, RemotingTimeoutException, InterruptedException {
//        =》
        return this.brokerController.getRemotingServer().invokeSync(channel, request, 10000);
    }
 
Example #30
Source File: MQAdminExt.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
boolean cleanUnusedTopic(String cluster) throws RemotingConnectException, RemotingSendRequestException,
RemotingTimeoutException, MQClientException, InterruptedException;