com.alibaba.rocketmq.tools.admin.api.MessageTrack Java Examples
The following examples show how to use
com.alibaba.rocketmq.tools.admin.api.MessageTrack.
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: MessageController.java From rocket-console with Apache License 2.0 | 5 votes |
@RequestMapping(value = "/viewMessage.query", method = RequestMethod.GET) @JsonBody public Object viewMessage(@RequestParam(required = false) String subject,@RequestParam String msgId) { Map<String, Object> messageViewMap = Maps.newHashMap(); Pair<MessageView, List<MessageTrack>> messageViewListPair = messageService.viewMessage(subject,msgId); messageViewMap.put("messageView", messageViewListPair.getObject1()); messageViewMap.put("messageTrackList", messageViewListPair.getObject2()); return messageViewMap; }
Example #2
Source File: MessageController.java From rocket-console with Apache License 2.0 | 5 votes |
@RequestMapping(value = "/viewMessageByBrokerAndOffset.query", method = RequestMethod.GET) @JsonBody public Object viewMessageByBrokerAndOffset(@RequestParam String brokerHost,@RequestParam int port, @RequestParam long offset) { Map<String, Object> messageViewMap = Maps.newHashMap(); Pair<MessageView, List<MessageTrack>> messageViewListPair = messageService.viewMessageByBrokerAndOffset(brokerHost,port, offset); messageViewMap.put("messageView", messageViewListPair.getObject1()); messageViewMap.put("messageTrackList", messageViewListPair.getObject2()); return messageViewMap; }
Example #3
Source File: MessageServiceImpl.java From rocket-console with Apache License 2.0 | 5 votes |
public Pair<MessageView, List<MessageTrack>> viewMessage(String subject, final String msgId) { try { MessageExt messageExt = mqAdminExt.viewMessage(msgId); List<MessageTrack> messageTrackList = messageTrackDetail(messageExt); return new Pair<>(MessageView.fromMessageExt(messageExt), messageTrackList); } catch (Exception e) { throw Throwables.propagate(e); } }
Example #4
Source File: MessageServiceImpl.java From rocket-console with Apache License 2.0 | 5 votes |
@Override public List<MessageTrack> messageTrackDetail(MessageExt msg) { try { return mqAdminExt.messageTrackDetail(msg); } catch (Exception e) { logger.error("op=messageTrackDetailError",e); return Collections.emptyList(); } }
Example #5
Source File: MessageServiceImpl.java From rocket-console with Apache License 2.0 | 5 votes |
@Override public Pair<MessageView, List<MessageTrack>> viewMessageByBrokerAndOffset(String brokerHost, int port, long offset) { ByteBuffer byteBufferMsgId = ByteBuffer.allocate(MSG_ID_LENGTH); SocketAddress brokerHostAddress = new InetSocketAddress(brokerHost, port); //通过broker信息以及offset构造一个offsetMessageId String msgId = MessageDecoder.createMessageId(byteBufferMsgId, MessageExt.socketAddress2ByteBuffer(brokerHostAddress), offset); return viewMessage(null, msgId); }
Example #6
Source File: QueryMsgByIdSubCommand.java From RocketMQ-Master-analyze with Apache License 2.0 | 4 votes |
public static void queryById(final DefaultMQAdminExt admin, final String msgId) throws MQClientException, RemotingException, MQBrokerException, InterruptedException, IOException { MessageExt msg = admin.viewMessage(msgId); // 存储消息 body 到指定路径 String bodyTmpFilePath = createBodyFile(msg); System.out.printf("%-20s %s\n", // "Topic:", // msg.getTopic()// ); System.out.printf("%-20s %s\n", // "Tags:", // "[" + msg.getTags() + "]"// ); System.out.printf("%-20s %s\n", // "Keys:", // "[" + msg.getKeys() + "]"// ); System.out.printf("%-20s %d\n", // "Queue ID:", // msg.getQueueId()// ); System.out.printf("%-20s %d\n", // "Queue Offset:", // msg.getQueueOffset()// ); System.out.printf("%-20s %d\n", // "CommitLog Offset:", // msg.getCommitLogOffset()// ); System.out.printf("%-20s %d\n", // "Reconsume Times:", // msg.getReconsumeTimes()// ); System.out.printf("%-20s %s\n", // "Born Timestamp:", // UtilAll.timeMillisToHumanString2(msg.getBornTimestamp())// ); System.out.printf("%-20s %s\n", // "Store Timestamp:", // UtilAll.timeMillisToHumanString2(msg.getStoreTimestamp())// ); System.out.printf("%-20s %s\n", // "Born Host:", // RemotingHelper.parseSocketAddressAddr(msg.getBornHost())// ); System.out.printf("%-20s %s\n", // "Store Host:", // RemotingHelper.parseSocketAddressAddr(msg.getStoreHost())// ); System.out.printf("%-20s %d\n", // "System Flag:", // msg.getSysFlag()// ); System.out.printf("%-20s %s\n", // "Properties:", // msg.getProperties() != null ? msg.getProperties().toString() : ""// ); System.out.printf("%-20s %s\n", // "Message Body Path:", // bodyTmpFilePath// ); try { List<MessageTrack> mtdList = admin.messageTrackDetail(msg); if (mtdList.isEmpty()) { System.out.println("\n\nWARN: No Consumer"); } else { System.out.println("\n\n"); for (MessageTrack mt : mtdList) { System.out.println(mt); } } } catch (Exception e) { e.printStackTrace(); } }
Example #7
Source File: DefaultMQAdminExt.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 4 votes |
@Override public List<MessageTrack> messageTrackDetail(MessageExt msg) throws RemotingException, MQClientException, InterruptedException, MQBrokerException { return this.defaultMQAdminExtImpl.`messageTrackDetail(msg); }
Example #8
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; }
Example #9
Source File: DefaultMQAdminExt.java From RocketMQ-Master-analyze with Apache License 2.0 | 4 votes |
@Override public List<MessageTrack> messageTrackDetail(MessageExt msg) throws RemotingException, MQClientException, InterruptedException, MQBrokerException { return this.defaultMQAdminExtImpl.messageTrackDetail(msg); }
Example #10
Source File: QueryMsgByUniqueKeySubCommand.java From rocketmq with Apache License 2.0 | 4 votes |
public static void queryById(final DefaultMQAdminExt admin, final String topic, final String msgId) throws MQClientException, RemotingException, MQBrokerException, InterruptedException, IOException { MessageExt msg = admin.viewMessage(topic,msgId); String bodyTmpFilePath = createBodyFile(msg); System.out.printf("%-20s %s%n",// "Topic:",// msg.getTopic()// ); System.out.printf("%-20s %s%n",// "Tags:",// "[" + msg.getTags() + "]"// ); System.out.printf("%-20s %s%n",// "Keys:",// "[" + msg.getKeys() + "]"// ); System.out.printf("%-20s %d%n",// "Queue ID:",// msg.getQueueId()// ); System.out.printf("%-20s %d%n",// "Queue Offset:",// msg.getQueueOffset()// ); System.out.printf("%-20s %d%n",// "CommitLog Offset:",// msg.getCommitLogOffset()// ); System.out.printf("%-20s %d%n",// "Reconsume Times:",// msg.getReconsumeTimes()// ); System.out.printf("%-20s %s%n",// "Born Timestamp:",// UtilAll.timeMillisToHumanString2(msg.getBornTimestamp())// ); System.out.printf("%-20s %s%n",// "Store Timestamp:",// UtilAll.timeMillisToHumanString2(msg.getStoreTimestamp())// ); System.out.printf("%-20s %s%n",// "Born Host:",// RemotingHelper.parseSocketAddressAddr(msg.getBornHost())// ); System.out.printf("%-20s %s%n",// "Store Host:",// RemotingHelper.parseSocketAddressAddr(msg.getStoreHost())// ); System.out.printf("%-20s %d%n",// "System Flag:",// msg.getSysFlag()// ); System.out.printf("%-20s %s%n",// "Properties:",// msg.getProperties() != null ? msg.getProperties().toString() : ""// ); System.out.printf("%-20s %s%n",// "Message Body Path:",// bodyTmpFilePath// ); try { List<MessageTrack> mtdList = admin.messageTrackDetail(msg); if (mtdList.isEmpty()) { System.out.println("\n\nWARN: No Consumer"); } else { System.out.println("\n\n"); for (MessageTrack mt : mtdList) { System.out.println(mt); } } } catch (Exception e) { e.printStackTrace(); } }
Example #11
Source File: QueryMsgByIdSubCommand.java From rocketmq with Apache License 2.0 | 4 votes |
public static void queryById(final DefaultMQAdminExt admin, final String msgId) throws MQClientException, RemotingException, MQBrokerException, InterruptedException, IOException { MessageExt msg = admin.viewMessage(msgId); String bodyTmpFilePath = createBodyFile(msg); System.out.printf("%-20s %s%n",// "Topic:",// msg.getTopic()// ); System.out.printf("%-20s %s%n",// "Tags:",// "[" + msg.getTags() + "]"// ); System.out.printf("%-20s %s%n",// "Keys:",// "[" + msg.getKeys() + "]"// ); System.out.printf("%-20s %d%n",// "Queue ID:",// msg.getQueueId()// ); System.out.printf("%-20s %d%n",// "Queue Offset:",// msg.getQueueOffset()// ); System.out.printf("%-20s %d%n",// "CommitLog Offset:",// msg.getCommitLogOffset()// ); System.out.printf("%-20s %d%n",// "Reconsume Times:",// msg.getReconsumeTimes()// ); System.out.printf("%-20s %s%n",// "Born Timestamp:",// UtilAll.timeMillisToHumanString2(msg.getBornTimestamp())// ); System.out.printf("%-20s %s%n",// "Store Timestamp:",// UtilAll.timeMillisToHumanString2(msg.getStoreTimestamp())// ); System.out.printf("%-20s %s%n",// "Born Host:",// RemotingHelper.parseSocketAddressAddr(msg.getBornHost())// ); System.out.printf("%-20s %s%n",// "Store Host:",// RemotingHelper.parseSocketAddressAddr(msg.getStoreHost())// ); System.out.printf("%-20s %d%n",// "System Flag:",// msg.getSysFlag()// ); System.out.printf("%-20s %s%n",// "Properties:",// msg.getProperties() != null ? msg.getProperties().toString() : ""// ); System.out.printf("%-20s %s%n",// "Message Body Path:",// bodyTmpFilePath// ); try { List<MessageTrack> mtdList = admin.messageTrackDetail(msg); if (mtdList.isEmpty()) { System.out.println("\n\nWARN: No Consumer"); } else { System.out.println("\n\n"); for (MessageTrack mt : mtdList) { System.out.println(mt); } } } catch (Exception e) { e.printStackTrace(); } }
Example #12
Source File: MQAdminExt.java From rocketmq with Apache License 2.0 | 4 votes |
List<MessageTrack> messageTrackDetail(MessageExt msg) throws RemotingException, MQClientException, InterruptedException, MQBrokerException;
Example #13
Source File: DefaultMQAdminExt.java From rocketmq with Apache License 2.0 | 4 votes |
@Override public List<MessageTrack> messageTrackDetail(MessageExt msg) throws RemotingException, MQClientException, InterruptedException, MQBrokerException { return this.defaultMQAdminExtImpl.messageTrackDetail(msg); }
Example #14
Source File: MQAdminExtImpl.java From rocket-console with Apache License 2.0 | 4 votes |
@Override public List<MessageTrack> messageTrackDetail(MessageExt msg) throws RemotingException, MQClientException, InterruptedException, MQBrokerException { return MQAdminInstance.threadLocalMQAdminExt().messageTrackDetail(msg); }
Example #15
Source File: QueryMsgByIdSubCommand.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 4 votes |
public static void queryById(final DefaultMQAdminExt admin, final String msgId) throws MQClientException, RemotingException, MQBrokerException, InterruptedException, IOException { MessageExt msg = admin.viewMessage(msgId); String bodyTmpFilePath = createBodyFile(msg); System.out.printf("%-20s %s\n",// "Topic:",// msg.getTopic()// ); System.out.printf("%-20s %s\n",// "Tags:",// "[" + msg.getTags() + "]"// ); System.out.printf("%-20s %s\n",// "Keys:",// "[" + msg.getKeys() + "]"// ); System.out.printf("%-20s %d\n",// "Queue ID:",// msg.getQueueId()// ); System.out.printf("%-20s %d\n",// "Queue Offset:",// msg.getQueueOffset()// ); System.out.printf("%-20s %d\n",// "CommitLog Offset:",// msg.getCommitLogOffset()// ); System.out.printf("%-20s %d\n",// "Reconsume Times:",// msg.getReconsumeTimes()// ); System.out.printf("%-20s %s\n",// "Born Timestamp:",// UtilAll.timeMillisToHumanString2(msg.getBornTimestamp())// ); System.out.printf("%-20s %s\n",// "Store Timestamp:",// UtilAll.timeMillisToHumanString2(msg.getStoreTimestamp())// ); System.out.printf("%-20s %s\n",// "Born Host:",// RemotingHelper.parseSocketAddressAddr(msg.getBornHost())// ); System.out.printf("%-20s %s\n",// "Store Host:",// RemotingHelper.parseSocketAddressAddr(msg.getStoreHost())// ); System.out.printf("%-20s %d\n",// "System Flag:",// msg.getSysFlag()// ); System.out.printf("%-20s %s\n",// "Properties:",// msg.getProperties() != null ? msg.getProperties().toString() : ""// ); System.out.printf("%-20s %s\n",// "Message Body Path:",// bodyTmpFilePath// ); try { List<MessageTrack> mtdList = admin.messageTrackDetail(msg); if (mtdList.isEmpty()) { System.out.println("\n\nWARN: No Consumer"); } else { System.out.println("\n\n"); for (MessageTrack mt : mtdList) { System.out.println(mt); } } } catch (Exception e) { e.printStackTrace(); } }
Example #16
Source File: MQAdminExt.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 4 votes |
List<MessageTrack> messageTrackDetail(MessageExt msg) throws RemotingException, MQClientException, InterruptedException, MQBrokerException;
Example #17
Source File: MessageService.java From rocket-console with Apache License 2.0 | 2 votes |
/** * * * @param subject * @param msgId * @return */ Pair<MessageView,List<MessageTrack>> viewMessage(String subject, final String msgId);
Example #18
Source File: MQAdminExt.java From RocketMQ-Master-analyze with Apache License 2.0 | 2 votes |
/** * 查询消息被谁消费了 * * @param msg * @return * @throws RemotingException * @throws MQClientException * @throws InterruptedException * @throws MQBrokerException */ public List<MessageTrack> messageTrackDetail(MessageExt msg) throws RemotingException, MQClientException, InterruptedException, MQBrokerException;
Example #19
Source File: MessageService.java From rocket-console with Apache License 2.0 | votes |
Pair<MessageView,List<MessageTrack>> viewMessageByBrokerAndOffset(String brokerHost, int port, long offset);
Example #20
Source File: MessageService.java From rocket-console with Apache License 2.0 | votes |
List<MessageTrack> messageTrackDetail(MessageExt msg);