org.apache.rocketmq.common.protocol.body.QueueTimeSpan Java Examples

The following examples show how to use org.apache.rocketmq.common.protocol.body.QueueTimeSpan. 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: 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 #2
Source File: QueryConsumeTimeSpanBodyTest.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testFromJson() throws Exception {
    QueryConsumeTimeSpanBody qctsb = new QueryConsumeTimeSpanBody();
    List<QueueTimeSpan> queueTimeSpans = new ArrayList<QueueTimeSpan>();
    QueueTimeSpan queueTimeSpan = new QueueTimeSpan();
    queueTimeSpan.setMinTimeStamp(1550825710000l);
    queueTimeSpan.setMaxTimeStamp(1550825790000l);
    queueTimeSpan.setConsumeTimeStamp(1550825760000l);
    queueTimeSpan.setDelayTime(5000l);
    MessageQueue messageQueue = new MessageQueue("topicName", "brokerName", 1);
    queueTimeSpan.setMessageQueue(messageQueue);
    queueTimeSpans.add(queueTimeSpan);
    qctsb.setConsumeTimeSpanSet(queueTimeSpans);
    String json = RemotingSerializable.toJson(qctsb, true);
    QueryConsumeTimeSpanBody fromJson = RemotingSerializable.fromJson(json, QueryConsumeTimeSpanBody.class);
    assertThat(fromJson.getConsumeTimeSpanSet().get(0).getMaxTimeStamp()).isEqualTo(1550825790000l);
    assertThat(fromJson.getConsumeTimeSpanSet().get(0).getMinTimeStamp()).isEqualTo(1550825710000l);
    assertThat(fromJson.getConsumeTimeSpanSet().get(0).getDelayTime()).isEqualTo(5000l);
    assertThat(fromJson.getConsumeTimeSpanSet().get(0).getMessageQueue()).isEqualTo(messageQueue);
}
 
Example #3
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 #4
Source File: MQClientAPIImpl.java    From rocketmq-4.3.0 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 #5
Source File: MQClientAPIImpl.java    From rocketmq 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 #6
Source File: MQClientAPIImpl.java    From rocketmq-read 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);

    String acturallyAddr = getActurallyBrokerAddr(addr);
    RemotingCommand response = this.remotingClient.invokeSync(MixAll.brokerVIPChannel(this.clientConfig.isVipChannelEnabled(), acturallyAddr),
        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: MQClientAPIImpl.java    From rocketmq-all-4.1.0-incubating 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 #8
Source File: DefaultMQPushConsumerImpl.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public List<QueueTimeSpan> queryConsumeTimeSpan(final String topic)
    throws RemotingException, MQClientException, InterruptedException, MQBrokerException {
    List<QueueTimeSpan> queueTimeSpan = new ArrayList<QueueTimeSpan>();
    TopicRouteData routeData = this.mQClientFactory.getMQClientAPIImpl().getTopicRouteInfoFromNameServer(topic, 3000);
    for (BrokerData brokerData : routeData.getBrokerDatas()) {
        String addr = brokerData.selectBrokerAddr();
        queueTimeSpan.addAll(this.mQClientFactory.getMQClientAPIImpl().queryConsumeTimeSpan(addr, topic, groupName(), 3000));
    }

    return queueTimeSpan;
}
 
Example #9
Source File: QueryConsumeTimeSpanBodyTest.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
private List<QueueTimeSpan> newUniqueConsumeTimeSpanSet() {
    List<QueueTimeSpan> queueTimeSpans = new ArrayList<QueueTimeSpan>();
    QueueTimeSpan queueTimeSpan = new QueueTimeSpan();
    queueTimeSpan.setMinTimeStamp(System.currentTimeMillis());
    queueTimeSpan.setMaxTimeStamp(UtilAll.computeNextHourTimeMillis());
    queueTimeSpan.setConsumeTimeStamp(UtilAll.computeNextMinutesTimeMillis());
    queueTimeSpan.setDelayTime(5000l);
    MessageQueue messageQueue = new MessageQueue(UUID.randomUUID().toString(), UUID.randomUUID().toString(), new Random().nextInt());
    queueTimeSpan.setMessageQueue(messageQueue);
    queueTimeSpans.add(queueTimeSpan);
    return queueTimeSpans;
}
 
Example #10
Source File: DefaultMQAdminExtImpl.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Override
public List<QueueTimeSpan> queryConsumeTimeSpan(final String topic, final String group) throws InterruptedException, MQBrokerException,
    RemotingException, MQClientException {
    List<QueueTimeSpan> spanSet = new ArrayList<QueueTimeSpan>();
    TopicRouteData topicRouteData = this.examineTopicRouteInfo(topic);
    for (BrokerData bd : topicRouteData.getBrokerDatas()) {
        String addr = bd.selectBrokerAddr();
        if (addr != null) {
            spanSet.addAll(this.mqClientInstance.getMQClientAPIImpl().queryConsumeTimeSpan(addr, topic, group, timeoutMillis));
        }
    }
    return spanSet;
}
 
Example #11
Source File: DefaultMQPushConsumerImpl.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public List<QueueTimeSpan> queryConsumeTimeSpan(final String topic)
    throws RemotingException, MQClientException, InterruptedException, MQBrokerException {
    List<QueueTimeSpan> queueTimeSpan = new ArrayList<QueueTimeSpan>();
    TopicRouteData routeData = this.mQClientFactory.getMQClientAPIImpl().getTopicRouteInfoFromNameServer(topic, 3000);
    for (BrokerData brokerData : routeData.getBrokerDatas()) {
        String addr = brokerData.selectBrokerAddr();
        queueTimeSpan.addAll(this.mQClientFactory.getMQClientAPIImpl().queryConsumeTimeSpan(addr, topic, groupName(), 3000));
    }

    return queueTimeSpan;
}
 
Example #12
Source File: DefaultMQAdminExtImpl.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Override
public List<QueueTimeSpan> queryConsumeTimeSpan(final String topic,
    final String group) throws InterruptedException, MQBrokerException,
    RemotingException, MQClientException {
    List<QueueTimeSpan> spanSet = new ArrayList<QueueTimeSpan>();
    TopicRouteData topicRouteData = this.examineTopicRouteInfo(topic);
    for (BrokerData bd : topicRouteData.getBrokerDatas()) {
        String addr = bd.selectBrokerAddr();
        if (addr != null) {
            spanSet.addAll(this.mqClientInstance.getMQClientAPIImpl().queryConsumeTimeSpan(addr, topic, group, timeoutMillis));
        }
    }
    return spanSet;
}
 
Example #13
Source File: DefaultMQPushConsumerImpl.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
public List<QueueTimeSpan> queryConsumeTimeSpan(final String topic)
    throws RemotingException, MQClientException, InterruptedException, MQBrokerException {
    List<QueueTimeSpan> queueTimeSpan = new ArrayList<QueueTimeSpan>();
    TopicRouteData routeData = this.mQClientFactory.getMQClientAPIImpl().getTopicRouteInfoFromNameServer(topic, 3000);
    for (BrokerData brokerData : routeData.getBrokerDatas()) {
        String addr = brokerData.selectBrokerAddr();
        queueTimeSpan.addAll(this.mQClientFactory.getMQClientAPIImpl().queryConsumeTimeSpan(addr, topic, groupName(), 3000));
    }

    return queueTimeSpan;
}
 
Example #14
Source File: DefaultMQAdminExtImpl.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
@Override
public List<QueueTimeSpan> queryConsumeTimeSpan(final String topic, final String group) throws InterruptedException, MQBrokerException,
    RemotingException, MQClientException {
    List<QueueTimeSpan> spanSet = new ArrayList<QueueTimeSpan>();
    TopicRouteData topicRouteData = this.examineTopicRouteInfo(topic);
    for (BrokerData bd : topicRouteData.getBrokerDatas()) {
        String addr = bd.selectBrokerAddr();
        if (addr != null) {
            spanSet.addAll(this.mqClientInstance.getMQClientAPIImpl().queryConsumeTimeSpan(addr, topic, group, timeoutMillis));
        }
    }
    return spanSet;
}
 
Example #15
Source File: DefaultMQPushConsumerImpl.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
public List<QueueTimeSpan> queryConsumeTimeSpan(final String topic)
    throws RemotingException, MQClientException, InterruptedException, MQBrokerException {
    List<QueueTimeSpan> queueTimeSpan = new ArrayList<QueueTimeSpan>();
    TopicRouteData routeData = this.mQClientFactory.getMQClientAPIImpl().getTopicRouteInfoFromNameServer(topic, 3000);
    for (BrokerData brokerData : routeData.getBrokerDatas()) {
        String addr = brokerData.selectBrokerAddr();
        queueTimeSpan.addAll(this.mQClientFactory.getMQClientAPIImpl().queryConsumeTimeSpan(addr, topic, groupName(), 3000));
    }

    return queueTimeSpan;
}
 
Example #16
Source File: DefaultMQPushConsumerImpl.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public List<QueueTimeSpan> queryConsumeTimeSpan(final String topic)
    throws RemotingException, MQClientException, InterruptedException, MQBrokerException {
    List<QueueTimeSpan> queueTimeSpan = new ArrayList<QueueTimeSpan>();
    TopicRouteData routeData = this.mQClientFactory.getMQClientAPIImpl().getTopicRouteInfoFromNameServer(topic, 3000);
    for (BrokerData brokerData : routeData.getBrokerDatas()) {
        String addr = brokerData.selectBrokerAddr();
        queueTimeSpan.addAll(this.mQClientFactory.getMQClientAPIImpl().queryConsumeTimeSpan(addr, topic, groupName(), 3000));
    }

    return queueTimeSpan;
}
 
Example #17
Source File: DefaultMQAdminExtImpl.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Override
public List<QueueTimeSpan> queryConsumeTimeSpan(final String topic,
    final String group) throws InterruptedException, MQBrokerException,
    RemotingException, MQClientException {
    List<QueueTimeSpan> spanSet = new ArrayList<QueueTimeSpan>();
    TopicRouteData topicRouteData = this.examineTopicRouteInfo(topic);
    for (BrokerData bd : topicRouteData.getBrokerDatas()) {
        String addr = bd.selectBrokerAddr();
        if (addr != null) {
            spanSet.addAll(this.mqClientInstance.getMQClientAPIImpl().queryConsumeTimeSpan(addr, topic, group, timeoutMillis));
        }
    }
    return spanSet;
}
 
Example #18
Source File: QueryConsumeTimeSpanBodyTest.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void testSetGet() throws Exception {
    QueryConsumeTimeSpanBody queryConsumeTimeSpanBody = new QueryConsumeTimeSpanBody();
    List<QueueTimeSpan> firstQueueTimeSpans = newUniqueConsumeTimeSpanSet();
    List<QueueTimeSpan> secondQueueTimeSpans = newUniqueConsumeTimeSpanSet();
    queryConsumeTimeSpanBody.setConsumeTimeSpanSet(firstQueueTimeSpans);
    assertThat(queryConsumeTimeSpanBody.getConsumeTimeSpanSet()).isEqualTo(firstQueueTimeSpans);
    assertThat(queryConsumeTimeSpanBody.getConsumeTimeSpanSet()).isNotEqualTo(secondQueueTimeSpans);
    queryConsumeTimeSpanBody.setConsumeTimeSpanSet(secondQueueTimeSpans);
    assertThat(queryConsumeTimeSpanBody.getConsumeTimeSpanSet()).isEqualTo(secondQueueTimeSpans);
    assertThat(queryConsumeTimeSpanBody.getConsumeTimeSpanSet()).isNotEqualTo(firstQueueTimeSpans);
}
 
Example #19
Source File: QueryConsumeTimeSpanBodyTest.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void testFromJsonRandom() throws Exception {
    QueryConsumeTimeSpanBody origin = new QueryConsumeTimeSpanBody();
    List<QueueTimeSpan> queueTimeSpans = newUniqueConsumeTimeSpanSet();
    origin.setConsumeTimeSpanSet(queueTimeSpans);
    String json = origin.toJson(true);
    QueryConsumeTimeSpanBody fromJson = RemotingSerializable.fromJson(json, QueryConsumeTimeSpanBody.class);
    assertThat(fromJson.getConsumeTimeSpanSet().get(0).getMinTimeStamp()).isEqualTo(origin.getConsumeTimeSpanSet().get(0).getMinTimeStamp());
    assertThat(fromJson.getConsumeTimeSpanSet().get(0).getMaxTimeStamp()).isEqualTo(origin.getConsumeTimeSpanSet().get(0).getMaxTimeStamp());
    assertThat(fromJson.getConsumeTimeSpanSet().get(0).getConsumeTimeStamp()).isEqualTo(origin.getConsumeTimeSpanSet().get(0).getConsumeTimeStamp());
    assertThat(fromJson.getConsumeTimeSpanSet().get(0).getDelayTime()).isEqualTo(origin.getConsumeTimeSpanSet().get(0).getDelayTime());
    assertThat(fromJson.getConsumeTimeSpanSet().get(0).getMessageQueue().getBrokerName()).isEqualTo(origin.getConsumeTimeSpanSet().get(0).getMessageQueue().getBrokerName());
    assertThat(fromJson.getConsumeTimeSpanSet().get(0).getMessageQueue().getTopic()).isEqualTo(origin.getConsumeTimeSpanSet().get(0).getMessageQueue().getTopic());
    assertThat(fromJson.getConsumeTimeSpanSet().get(0).getMessageQueue().getQueueId()).isEqualTo(origin.getConsumeTimeSpanSet().get(0).getMessageQueue().getQueueId());
}
 
Example #20
Source File: QueryConsumeTimeSpanBodyTest.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void testEncode() throws Exception {
    QueryConsumeTimeSpanBody origin = new QueryConsumeTimeSpanBody();
    List<QueueTimeSpan> queueTimeSpans = newUniqueConsumeTimeSpanSet();
    origin.setConsumeTimeSpanSet(queueTimeSpans);
    byte[] data = origin.encode();
    QueryConsumeTimeSpanBody fromData = RemotingSerializable.decode(data, QueryConsumeTimeSpanBody.class);
    assertThat(fromData.getConsumeTimeSpanSet().get(0).getMinTimeStamp()).isEqualTo(origin.getConsumeTimeSpanSet().get(0).getMinTimeStamp());
    assertThat(fromData.getConsumeTimeSpanSet().get(0).getMaxTimeStamp()).isEqualTo(origin.getConsumeTimeSpanSet().get(0).getMaxTimeStamp());
    assertThat(fromData.getConsumeTimeSpanSet().get(0).getConsumeTimeStamp()).isEqualTo(origin.getConsumeTimeSpanSet().get(0).getConsumeTimeStamp());
    assertThat(fromData.getConsumeTimeSpanSet().get(0).getDelayTime()).isEqualTo(origin.getConsumeTimeSpanSet().get(0).getDelayTime());
    assertThat(fromData.getConsumeTimeSpanSet().get(0).getMessageQueue().getBrokerName()).isEqualTo(origin.getConsumeTimeSpanSet().get(0).getMessageQueue().getBrokerName());
    assertThat(fromData.getConsumeTimeSpanSet().get(0).getMessageQueue().getTopic()).isEqualTo(origin.getConsumeTimeSpanSet().get(0).getMessageQueue().getTopic());
    assertThat(fromData.getConsumeTimeSpanSet().get(0).getMessageQueue().getQueueId()).isEqualTo(origin.getConsumeTimeSpanSet().get(0).getMessageQueue().getQueueId());
}
 
Example #21
Source File: DefaultMQPushConsumerImpl.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public List<QueueTimeSpan> queryConsumeTimeSpan(final String topic)
    throws RemotingException, MQClientException, InterruptedException, MQBrokerException {
    List<QueueTimeSpan> queueTimeSpan = new ArrayList<QueueTimeSpan>();
    TopicRouteData routeData = this.mQClientFactory.getMQClientAPIImpl().getTopicRouteInfoFromNameServer(topic, 3000);
    for (BrokerData brokerData : routeData.getBrokerDatas()) {
        String addr = brokerData.selectBrokerAddr();
        queueTimeSpan.addAll(this.mQClientFactory.getMQClientAPIImpl().queryConsumeTimeSpan(addr, topic, groupName(), 3000));
    }

    return queueTimeSpan;
}
 
Example #22
Source File: DefaultMQAdminExtImpl.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Override
public List<QueueTimeSpan> queryConsumeTimeSpan(final String topic,
    final String group) throws InterruptedException, MQBrokerException,
    RemotingException, MQClientException {
    List<QueueTimeSpan> spanSet = new ArrayList<QueueTimeSpan>();
    TopicRouteData topicRouteData = this.examineTopicRouteInfo(topic);
    for (BrokerData bd : topicRouteData.getBrokerDatas()) {
        String addr = bd.selectBrokerAddr();
        if (addr != null) {
            spanSet.addAll(this.mqClientInstance.getMQClientAPIImpl().queryConsumeTimeSpan(addr, topic, group, timeoutMillis));
        }
    }
    return spanSet;
}
 
Example #23
Source File: DefaultMQAdminExtImpl.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
@Override
public List<QueueTimeSpan> queryConsumeTimeSpan(final String topic,
    final String group) throws InterruptedException, MQBrokerException,
    RemotingException, MQClientException {
    List<QueueTimeSpan> spanSet = new ArrayList<QueueTimeSpan>();
    TopicRouteData topicRouteData = this.examineTopicRouteInfo(topic);
    for (BrokerData bd : topicRouteData.getBrokerDatas()) {
        String addr = bd.selectBrokerAddr();
        if (addr != null) {
            spanSet.addAll(this.mqClientInstance.getMQClientAPIImpl().queryConsumeTimeSpan(addr, topic, group, timeoutMillis));
        }
    }
    return spanSet;
}
 
Example #24
Source File: DefaultMQPushConsumerImpl.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
public List<QueueTimeSpan> queryConsumeTimeSpan(final String topic)
    throws RemotingException, MQClientException, InterruptedException, MQBrokerException {
    List<QueueTimeSpan> queueTimeSpan = new ArrayList<QueueTimeSpan>();
    TopicRouteData routeData = this.mQClientFactory.getMQClientAPIImpl().getTopicRouteInfoFromNameServer(topic, 3000);
    for (BrokerData brokerData : routeData.getBrokerDatas()) {
        String addr = brokerData.selectBrokerAddr();
        queueTimeSpan.addAll(this.mQClientFactory.getMQClientAPIImpl().queryConsumeTimeSpan(addr, topic, groupName(), 3000));
    }

    return queueTimeSpan;
}
 
Example #25
Source File: DefaultMQAdminExtImpl.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
@Override
public List<QueueTimeSpan> queryConsumeTimeSpan(final String topic,
    final String group) throws InterruptedException, MQBrokerException,
    RemotingException, MQClientException {
    List<QueueTimeSpan> spanSet = new ArrayList<QueueTimeSpan>();
    TopicRouteData topicRouteData = this.examineTopicRouteInfo(topic);
    for (BrokerData bd : topicRouteData.getBrokerDatas()) {
        String addr = bd.selectBrokerAddr();
        if (addr != null) {
            spanSet.addAll(this.mqClientInstance.getMQClientAPIImpl().queryConsumeTimeSpan(addr, topic, group, timeoutMillis));
        }
    }
    return spanSet;
}
 
Example #26
Source File: DefaultMQPushConsumerImpl.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
public List<QueueTimeSpan> queryConsumeTimeSpan(final String topic)
    throws RemotingException, MQClientException, InterruptedException, MQBrokerException {
    List<QueueTimeSpan> queueTimeSpan = new ArrayList<QueueTimeSpan>();
    TopicRouteData routeData = this.mQClientFactory.getMQClientAPIImpl().getTopicRouteInfoFromNameServer(topic, 3000);
    for (BrokerData brokerData : routeData.getBrokerDatas()) {
        String addr = brokerData.selectBrokerAddr();
        queueTimeSpan.addAll(this.mQClientFactory.getMQClientAPIImpl().queryConsumeTimeSpan(addr, topic, groupName(), 3000));
    }

    return queueTimeSpan;
}
 
Example #27
Source File: MQAdminExt.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 4 votes vote down vote up
List<QueueTimeSpan> queryConsumeTimeSpan(final String topic, final String group) throws InterruptedException, MQBrokerException,
RemotingException, MQClientException;
 
Example #28
Source File: DefaultMQAdminExt.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 4 votes vote down vote up
@Override
public List<QueueTimeSpan> queryConsumeTimeSpan(final String topic, final String group) throws InterruptedException, MQBrokerException,
    RemotingException, MQClientException {
    return this.defaultMQAdminExtImpl.queryConsumeTimeSpan(topic, group);
}
 
Example #29
Source File: DefaultMQAdminExtTest.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 4 votes vote down vote up
@Test
public void testQueryConsumeTimeSpan() throws InterruptedException, RemotingException, MQClientException, MQBrokerException {
    List<QueueTimeSpan> result = defaultMQAdminExt.queryConsumeTimeSpan("unit-test", "default-broker-group");
    assertThat(result.size()).isEqualTo(0);
}
 
Example #30
Source File: DefaultMQAdminExt.java    From rocketmq-4.3.0 with Apache License 2.0 4 votes vote down vote up
@Override
public List<QueueTimeSpan> queryConsumeTimeSpan(final String topic,
    final String group) throws InterruptedException, MQBrokerException,
    RemotingException, MQClientException {
    return this.defaultMQAdminExtImpl.queryConsumeTimeSpan(topic, group);
}