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);
}