com.alibaba.rocketmq.tools.admin.api.TrackType Java Examples
The following examples show how to use
com.alibaba.rocketmq.tools.admin.api.TrackType.
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: DefaultMQAdminExtImpl.java From RocketMQ-Master-analyze with Apache License 2.0 | 4 votes |
@Override public List<MessageTrack> messageTrackDetail(MessageExt msg) throws RemotingException, MQClientException, InterruptedException, MQBrokerException { List<MessageTrack> result = new ArrayList<MessageTrack>(); GroupList groupList = this.queryTopicConsumeByWho(msg.getTopic()); for (String group : groupList.getGroupList()) { // 查询连接 MessageTrack mt = new MessageTrack(); mt.setConsumerGroup(group); mt.setTrackType(TrackType.UNKNOW_EXCEPTION); try { ConsumerConnection cc = this.examineConsumerConnectionInfo(group); switch (cc.getConsumeType()) { case CONSUME_ACTIVELY: mt.setTrackType(TrackType.SUBSCRIBED_BUT_PULL); break; case CONSUME_PASSIVELY: boolean ifConsumed = this.consumed(msg, group); if (ifConsumed) { mt.setTrackType(TrackType.SUBSCRIBED_AND_CONSUMED); // 查看订阅关系是否匹配 Iterator<Entry<String, SubscriptionData>> it = cc.getSubscriptionTable().entrySet().iterator(); while (it.hasNext()) { Entry<String, SubscriptionData> next = it.next(); if (next.getKey().equals(msg.getTopic())) { if (next.getValue().getTagsSet().contains(msg.getTags()) // || next.getValue().getTagsSet().contains("*")// || next.getValue().getTagsSet().isEmpty()// ) { } else { mt.setTrackType(TrackType.SUBSCRIBED_BUT_FILTERD); } } } } else { mt.setTrackType(TrackType.SUBSCRIBED_AND_NOT_CONSUME_YET); } break; default: break; } } catch (Exception e) { mt.setExceptionDesc(RemotingHelper.exceptionSimpleDesc(e)); } result.add(mt); } return result; }