Java Code Examples for org.apache.rocketmq.common.protocol.body.QueryConsumeQueueResponseBody#getQueueData()
The following examples show how to use
org.apache.rocketmq.common.protocol.body.QueryConsumeQueueResponseBody#getQueueData() .
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: QueryConsumeQueueCommand.java From DDMQ with Apache License 2.0 | 4 votes |
@Override public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) { DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook); defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis())); try { defaultMQAdminExt.start(); String topic = commandLine.getOptionValue("t").trim(); int queueId = Integer.valueOf(commandLine.getOptionValue("q").trim()); long index = Long.valueOf(commandLine.getOptionValue("i").trim()); int count = Integer.valueOf(commandLine.getOptionValue("c", "10").trim()); String broker = null; if (commandLine.hasOption("b")) { broker = commandLine.getOptionValue("b").trim(); } String consumerGroup = null; if (commandLine.hasOption("g")) { consumerGroup = commandLine.getOptionValue("g").trim(); } if (broker == null || broker == "") { TopicRouteData topicRouteData = defaultMQAdminExt.examineTopicRouteInfo(topic); if (topicRouteData == null || topicRouteData.getBrokerDatas() == null || topicRouteData.getBrokerDatas().isEmpty()) { throw new Exception("No topic route data!"); } broker = topicRouteData.getBrokerDatas().get(0).getBrokerAddrs().get(0L); } QueryConsumeQueueResponseBody queryConsumeQueueResponseBody = defaultMQAdminExt.queryConsumeQueue( broker, topic, queueId, index, count, consumerGroup ); if (queryConsumeQueueResponseBody.getSubscriptionData() != null) { System.out.printf("Subscription data: \n%s\n", JSON.toJSONString(queryConsumeQueueResponseBody.getSubscriptionData(), true)); System.out.print("======================================\n"); } if (queryConsumeQueueResponseBody.getFilterData() != null) { System.out.printf("Filter data: \n%s\n", queryConsumeQueueResponseBody.getFilterData()); System.out.print("======================================\n"); } System.out.printf("Queue data: \nmax: %d, min: %d\n", queryConsumeQueueResponseBody.getMaxQueueIndex(), queryConsumeQueueResponseBody.getMinQueueIndex()); System.out.print("======================================\n"); if (queryConsumeQueueResponseBody.getQueueData() != null) { long i = index; for (ConsumeQueueData queueData : queryConsumeQueueResponseBody.getQueueData()) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("idx: " + i + "\n"); stringBuilder.append(queueData.toString() + "\n"); stringBuilder.append("======================================\n"); System.out.print(stringBuilder.toString()); i++; } } } catch (Exception e) { e.printStackTrace(); } finally { defaultMQAdminExt.shutdown(); } }
Example 2
Source File: QueryConsumeQueueCommand.java From rocketmq-4.3.0 with Apache License 2.0 | 4 votes |
@Override public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) { DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook); defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis())); try { defaultMQAdminExt.start(); String topic = commandLine.getOptionValue("t").trim(); int queueId = Integer.valueOf(commandLine.getOptionValue("q").trim()); long index = Long.valueOf(commandLine.getOptionValue("i").trim()); int count = Integer.valueOf(commandLine.getOptionValue("c", "10").trim()); String broker = null; if (commandLine.hasOption("b")) { broker = commandLine.getOptionValue("b").trim(); } String consumerGroup = null; if (commandLine.hasOption("g")) { consumerGroup = commandLine.getOptionValue("g").trim(); } if (broker == null || broker == "") { TopicRouteData topicRouteData = defaultMQAdminExt.examineTopicRouteInfo(topic); if (topicRouteData == null || topicRouteData.getBrokerDatas() == null || topicRouteData.getBrokerDatas().isEmpty()) { throw new Exception("No topic route data!"); } broker = topicRouteData.getBrokerDatas().get(0).getBrokerAddrs().get(0L); } QueryConsumeQueueResponseBody queryConsumeQueueResponseBody = defaultMQAdminExt.queryConsumeQueue( broker, topic, queueId, index, count, consumerGroup ); if (queryConsumeQueueResponseBody.getSubscriptionData() != null) { System.out.printf("Subscription data: \n%s\n", JSON.toJSONString(queryConsumeQueueResponseBody.getSubscriptionData(), true)); System.out.print("======================================\n"); } if (queryConsumeQueueResponseBody.getFilterData() != null) { System.out.printf("Filter data: \n%s\n", queryConsumeQueueResponseBody.getFilterData()); System.out.print("======================================\n"); } System.out.printf("Queue data: \nmax: %d, min: %d\n", queryConsumeQueueResponseBody.getMaxQueueIndex(), queryConsumeQueueResponseBody.getMinQueueIndex()); System.out.print("======================================\n"); if (queryConsumeQueueResponseBody.getQueueData() != null) { long i = index; for (ConsumeQueueData queueData : queryConsumeQueueResponseBody.getQueueData()) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("idx: " + i + "\n"); stringBuilder.append(queueData.toString() + "\n"); stringBuilder.append("======================================\n"); System.out.print(stringBuilder.toString()); i++; } } } catch (Exception e) { e.printStackTrace(); } finally { defaultMQAdminExt.shutdown(); } }
Example 3
Source File: QueryConsumeQueueCommand.java From rocketmq-read with Apache License 2.0 | 4 votes |
@Override public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) { DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook); defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis())); try { defaultMQAdminExt.start(); String topic = commandLine.getOptionValue("t").trim(); int queueId = Integer.valueOf(commandLine.getOptionValue("q").trim()); long index = Long.valueOf(commandLine.getOptionValue("i").trim()); int count = Integer.valueOf(commandLine.getOptionValue("c", "10").trim()); String broker = null; if (commandLine.hasOption("b")) { broker = commandLine.getOptionValue("b").trim(); } String consumerGroup = null; if (commandLine.hasOption("g")) { consumerGroup = commandLine.getOptionValue("g").trim(); } if (broker == null || broker == "") { TopicRouteData topicRouteData = defaultMQAdminExt.examineTopicRouteInfo(topic); if (topicRouteData == null || topicRouteData.getBrokerDatas() == null || topicRouteData.getBrokerDatas().isEmpty()) { throw new Exception("No topic route data!"); } broker = topicRouteData.getBrokerDatas().get(0).getBrokerAddrs().get(0L); } QueryConsumeQueueResponseBody queryConsumeQueueResponseBody = defaultMQAdminExt.queryConsumeQueue( broker, topic, queueId, index, count, consumerGroup ); if (queryConsumeQueueResponseBody.getSubscriptionData() != null) { System.out.printf("Subscription data: \n%s\n", JSON.toJSONString(queryConsumeQueueResponseBody.getSubscriptionData(), true)); System.out.print("======================================\n"); } if (queryConsumeQueueResponseBody.getFilterData() != null) { System.out.printf("Filter data: \n%s\n", queryConsumeQueueResponseBody.getFilterData()); System.out.print("======================================\n"); } System.out.printf("Queue data: \nmax: %d, min: %d\n", queryConsumeQueueResponseBody.getMaxQueueIndex(), queryConsumeQueueResponseBody.getMinQueueIndex()); System.out.print("======================================\n"); if (queryConsumeQueueResponseBody.getQueueData() != null) { long i = index; for (ConsumeQueueData queueData : queryConsumeQueueResponseBody.getQueueData()) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("idx: " + i + "\n"); stringBuilder.append(queueData.toString() + "\n"); stringBuilder.append("======================================\n"); System.out.print(stringBuilder.toString()); i++; } } } catch (Exception e) { e.printStackTrace(); } finally { defaultMQAdminExt.shutdown(); } }
Example 4
Source File: QueryConsumeQueueCommand.java From DDMQ with Apache License 2.0 | 4 votes |
@Override public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) { DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook); defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis())); try { defaultMQAdminExt.start(); String topic = commandLine.getOptionValue("t").trim(); int queueId = Integer.valueOf(commandLine.getOptionValue("q").trim()); long index = Long.valueOf(commandLine.getOptionValue("i").trim()); int count = Integer.valueOf(commandLine.getOptionValue("c", "10").trim()); String broker = null; if (commandLine.hasOption("b")) { broker = commandLine.getOptionValue("b").trim(); } String consumerGroup = null; if (commandLine.hasOption("g")) { consumerGroup = commandLine.getOptionValue("g").trim(); } if (broker == null || broker == "") { TopicRouteData topicRouteData = defaultMQAdminExt.examineTopicRouteInfo(topic); if (topicRouteData == null || topicRouteData.getBrokerDatas() == null || topicRouteData.getBrokerDatas().isEmpty()) { throw new Exception("No topic route data!"); } broker = topicRouteData.getBrokerDatas().get(0).getBrokerAddrs().get(0L); } QueryConsumeQueueResponseBody queryConsumeQueueResponseBody = defaultMQAdminExt.queryConsumeQueue( broker, topic, queueId, index, count, consumerGroup ); if (queryConsumeQueueResponseBody.getSubscriptionData() != null) { System.out.printf("Subscription data: \n%s\n", JSON.toJSONString(queryConsumeQueueResponseBody.getSubscriptionData(), true)); System.out.print("======================================\n"); } if (queryConsumeQueueResponseBody.getFilterData() != null) { System.out.printf("Filter data: \n%s\n", queryConsumeQueueResponseBody.getFilterData()); System.out.print("======================================\n"); } System.out.printf("Queue data: \nmax: %d, min: %d\n", queryConsumeQueueResponseBody.getMaxQueueIndex(), queryConsumeQueueResponseBody.getMinQueueIndex()); System.out.print("======================================\n"); if (queryConsumeQueueResponseBody.getQueueData() != null) { long i = index; for (ConsumeQueueData queueData : queryConsumeQueueResponseBody.getQueueData()) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("idx: " + i + "\n"); stringBuilder.append(queueData.toString() + "\n"); stringBuilder.append("======================================\n"); System.out.print(stringBuilder.toString()); i++; } } } catch (Exception e) { e.printStackTrace(); } finally { defaultMQAdminExt.shutdown(); } }
Example 5
Source File: QueryConsumeQueueCommand.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 4 votes |
@Override public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) { DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook); defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis())); try { defaultMQAdminExt.start(); String topic = commandLine.getOptionValue("t").trim(); int queueId = Integer.valueOf(commandLine.getOptionValue("q").trim()); long index = Long.valueOf(commandLine.getOptionValue("i").trim()); int count = Integer.valueOf(commandLine.getOptionValue("c", "10").trim()); String broker = null; if (commandLine.hasOption("b")) { broker = commandLine.getOptionValue("b").trim(); } String consumerGroup = null; if (commandLine.hasOption("g")) { consumerGroup = commandLine.getOptionValue("g").trim(); } if (broker == null || broker == "") { TopicRouteData topicRouteData = defaultMQAdminExt.examineTopicRouteInfo(topic); if (topicRouteData == null || topicRouteData.getBrokerDatas() == null || topicRouteData.getBrokerDatas().isEmpty()) { throw new Exception("No topic route data!"); } broker = topicRouteData.getBrokerDatas().get(0).getBrokerAddrs().get(0L); } QueryConsumeQueueResponseBody queryConsumeQueueResponseBody = defaultMQAdminExt.queryConsumeQueue( broker, topic, queueId, index, count, consumerGroup ); if (queryConsumeQueueResponseBody.getSubscriptionData() != null) { System.out.printf("Subscription data: \n%s\n", JSON.toJSONString(queryConsumeQueueResponseBody.getSubscriptionData(), true)); System.out.print("======================================\n"); } if (queryConsumeQueueResponseBody.getFilterData() != null) { System.out.printf("Filter data: \n%s\n", queryConsumeQueueResponseBody.getFilterData()); System.out.print("======================================\n"); } System.out.printf("Queue data: \nmax: %d, min: %d\n", queryConsumeQueueResponseBody.getMaxQueueIndex(), queryConsumeQueueResponseBody.getMinQueueIndex()); System.out.print("======================================\n"); if (queryConsumeQueueResponseBody.getQueueData() != null) { long i = index; for (ConsumeQueueData queueData : queryConsumeQueueResponseBody.getQueueData()) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("idx: " + i + "\n"); stringBuilder.append(queueData.toString() + "\n"); stringBuilder.append("======================================\n"); System.out.print(stringBuilder.toString()); i++; } } } catch (Exception e) { e.printStackTrace(); } finally { defaultMQAdminExt.shutdown(); } }
Example 6
Source File: QueryConsumeQueueCommand.java From rocketmq with Apache License 2.0 | 4 votes |
@Override public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) { DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook); defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis())); try { defaultMQAdminExt.start(); String topic = commandLine.getOptionValue("t").trim(); int queueId = Integer.valueOf(commandLine.getOptionValue("q").trim()); long index = Long.valueOf(commandLine.getOptionValue("i").trim()); int count = Integer.valueOf(commandLine.getOptionValue("c", "10").trim()); String broker = null; if (commandLine.hasOption("b")) { broker = commandLine.getOptionValue("b").trim(); } String consumerGroup = null; if (commandLine.hasOption("g")) { consumerGroup = commandLine.getOptionValue("g").trim(); } if (broker == null || broker == "") { TopicRouteData topicRouteData = defaultMQAdminExt.examineTopicRouteInfo(topic); if (topicRouteData == null || topicRouteData.getBrokerDatas() == null || topicRouteData.getBrokerDatas().isEmpty()) { throw new Exception("No topic route data!"); } broker = topicRouteData.getBrokerDatas().get(0).getBrokerAddrs().get(0L); } QueryConsumeQueueResponseBody queryConsumeQueueResponseBody = defaultMQAdminExt.queryConsumeQueue( broker, topic, queueId, index, count, consumerGroup ); if (queryConsumeQueueResponseBody.getSubscriptionData() != null) { System.out.printf("Subscription data: \n%s\n", JSON.toJSONString(queryConsumeQueueResponseBody.getSubscriptionData(), true)); System.out.print("======================================\n"); } if (queryConsumeQueueResponseBody.getFilterData() != null) { System.out.printf("Filter data: \n%s\n", queryConsumeQueueResponseBody.getFilterData()); System.out.print("======================================\n"); } System.out.printf("Queue data: \nmax: %d, min: %d\n", queryConsumeQueueResponseBody.getMaxQueueIndex(), queryConsumeQueueResponseBody.getMinQueueIndex()); System.out.print("======================================\n"); if (queryConsumeQueueResponseBody.getQueueData() != null) { long i = index; for (ConsumeQueueData queueData : queryConsumeQueueResponseBody.getQueueData()) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("idx: " + i + "\n"); stringBuilder.append(queueData.toString() + "\n"); stringBuilder.append("======================================\n"); System.out.print(stringBuilder.toString()); i++; } } } catch (Exception e) { e.printStackTrace(); } finally { defaultMQAdminExt.shutdown(); } }