com.alibaba.rocketmq.common.protocol.body.Connection Java Examples
The following examples show how to use
com.alibaba.rocketmq.common.protocol.body.Connection.
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: MonitorService.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 6 votes |
public void reportConsumerRunningInfo(final String consumerGroup) throws InterruptedException, MQBrokerException, RemotingException, MQClientException { ConsumerConnection cc = defaultMQAdminExt.examineConsumerConnectionInfo(consumerGroup); TreeMap<String, ConsumerRunningInfo> infoMap = new TreeMap<String, ConsumerRunningInfo>(); for (Connection c : cc.getConnectionSet()) { String clientId = c.getClientId(); if (c.getVersion() < MQVersion.Version.V3_1_8_SNAPSHOT.ordinal()) { continue; } try { ConsumerRunningInfo info = defaultMQAdminExt.getConsumerRunningInfo(consumerGroup, clientId, false); infoMap.put(clientId, info); } catch (Exception e) { } } if (!infoMap.isEmpty()) { this.monitorListener.reportConsumerRunningInfo(infoMap); } }
Example #2
Source File: MonitorService.java From rocketmq with Apache License 2.0 | 6 votes |
public void reportConsumerRunningInfo(final String consumerGroup) throws InterruptedException, MQBrokerException, RemotingException, MQClientException { ConsumerConnection cc = defaultMQAdminExt.examineConsumerConnectionInfo(consumerGroup); TreeMap<String, ConsumerRunningInfo> infoMap = new TreeMap<String, ConsumerRunningInfo>(); for (Connection c : cc.getConnectionSet()) { String clientId = c.getClientId(); if (c.getVersion() < MQVersion.Version.V3_1_8_SNAPSHOT.ordinal()) { continue; } try { ConsumerRunningInfo info = defaultMQAdminExt.getConsumerRunningInfo(consumerGroup, clientId, false); infoMap.put(clientId, info); } catch (Exception e) { } } if (!infoMap.isEmpty()) { this.monitorListener.reportConsumerRunningInfo(infoMap); } }
Example #3
Source File: MonitorService.java From RocketMQ-Master-analyze with Apache License 2.0 | 6 votes |
public void reportConsumerRunningInfo(final String consumerGroup) throws InterruptedException, MQBrokerException, RemotingException, MQClientException { ConsumerConnection cc = defaultMQAdminExt.examineConsumerConnectionInfo(consumerGroup); TreeMap<String, ConsumerRunningInfo> infoMap = new TreeMap<String, ConsumerRunningInfo>(); for (Connection c : cc.getConnectionSet()) { String clientId = c.getClientId(); // 低于3.1.8版本,不支持此功能 if (c.getVersion() < MQVersion.Version.V3_1_8_SNAPSHOT.ordinal()) { continue; } try { ConsumerRunningInfo info = defaultMQAdminExt.getConsumerRunningInfo(consumerGroup, clientId, false); infoMap.put(clientId, info); } catch (Exception e) { } } if (!infoMap.isEmpty()) { this.monitorListener.reportConsumerRunningInfo(infoMap); } }
Example #4
Source File: ProducerConnectionSubCommand.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 5 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 group = commandLine.getOptionValue('g').trim(); String topic = commandLine.getOptionValue('t').trim(); ProducerConnection pc = defaultMQAdminExt.examineProducerConnectionInfo(group, topic); int i = 1; for (Connection conn : pc.getConnectionSet()) { System.out.printf("%04d %-32s %-22s %-8s %s\n",// i++,// conn.getClientId(),// conn.getClientAddr(),// conn.getLanguage(),// MQVersion.getVersionDesc(conn.getVersion())// ); } } catch (Exception e) { e.printStackTrace(); } finally { defaultMQAdminExt.shutdown(); } }
Example #5
Source File: ProducerConnectionSubCommand.java From rocketmq with Apache License 2.0 | 5 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 group = commandLine.getOptionValue('g').trim(); String topic = commandLine.getOptionValue('t').trim(); ProducerConnection pc = defaultMQAdminExt.examineProducerConnectionInfo(group, topic); int i = 1; for (Connection conn : pc.getConnectionSet()) { System.out.printf("%04d %-32s %-22s %-8s %s%n",// i++,// conn.getClientId(),// conn.getClientAddr(),// conn.getLanguage(),// MQVersion.getVersionDesc(conn.getVersion())// ); } } catch (Exception e) { e.printStackTrace(); } finally { defaultMQAdminExt.shutdown(); } }
Example #6
Source File: ProducerConnectionSubCommand.java From RocketMQ-Master-analyze with Apache License 2.0 | 5 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 group = commandLine.getOptionValue('g').trim(); String topic = commandLine.getOptionValue('t').trim(); ProducerConnection pc = defaultMQAdminExt.examineProducerConnectionInfo(group, topic); int i = 1; for (Connection conn : pc.getConnectionSet()) { System.out.printf("%04d %-32s %-22s %-8s %s\n", // i++, // conn.getClientId(), // conn.getClientAddr(), // conn.getLanguage(), // MQVersion.getVersionDesc(conn.getVersion())// ); } } catch (Exception e) { e.printStackTrace(); } finally { defaultMQAdminExt.shutdown(); } }
Example #7
Source File: ConsumerConnectionSubCommand.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.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 group = commandLine.getOptionValue('g').trim(); ConsumerConnection cc = defaultMQAdminExt.examineConsumerConnectionInfo(group); int i = 1; for (Connection conn : cc.getConnectionSet()) { System.out.printf("%03d %-32s %-22s %-8s %s\n",// i++,// conn.getClientId(),// conn.getClientAddr(),// conn.getLanguage(),// MQVersion.getVersionDesc(conn.getVersion())// ); } System.out.println("\nBelow is subscription:"); Iterator<Entry<String, SubscriptionData>> it = cc.getSubscriptionTable().entrySet().iterator(); i = 1; while (it.hasNext()) { Entry<String, SubscriptionData> entry = it.next(); SubscriptionData sd = entry.getValue(); System.out.printf("%03d Topic: %-40s SubExpression: %s\n",// i++,// sd.getTopic(),// sd.getSubString()// ); } System.out.println(""); System.out.printf("ConsumeType: %s\n", cc.getConsumeType()); System.out.printf("MessageModel: %s\n", cc.getMessageModel()); System.out.printf("ConsumeFromWhere: %s\n", cc.getConsumeFromWhere()); } catch (Exception e) { e.printStackTrace(); } finally { defaultMQAdminExt.shutdown(); } }
Example #8
Source File: ConsumerConnectionSubCommand.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 group = commandLine.getOptionValue('g').trim(); ConsumerConnection cc = defaultMQAdminExt.examineConsumerConnectionInfo(group); int i = 1; for (Connection conn : cc.getConnectionSet()) { System.out.printf("%03d %-32s %-22s %-8s %s%n",// i++,// conn.getClientId(),// conn.getClientAddr(),// conn.getLanguage(),// MQVersion.getVersionDesc(conn.getVersion())// ); } System.out.println("\nBelow is subscription:"); Iterator<Entry<String, SubscriptionData>> it = cc.getSubscriptionTable().entrySet().iterator(); i = 1; while (it.hasNext()) { Entry<String, SubscriptionData> entry = it.next(); SubscriptionData sd = entry.getValue(); System.out.printf("%03d Topic: %-40s SubExpression: %s%n",// i++,// sd.getTopic(),// sd.getSubString()// ); } System.out.println(""); System.out.printf("ConsumeType: %s%n", cc.getConsumeType()); System.out.printf("MessageModel: %s%n", cc.getMessageModel()); System.out.printf("ConsumeFromWhere: %s%n", cc.getConsumeFromWhere()); } catch (Exception e) { e.printStackTrace(); } finally { defaultMQAdminExt.shutdown(); } }
Example #9
Source File: ConsumerConnectionSubCommand.java From RocketMQ-Master-analyze 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 group = commandLine.getOptionValue('g').trim(); ConsumerConnection cc = defaultMQAdminExt.examineConsumerConnectionInfo(group); // 打印连接 int i = 1; for (Connection conn : cc.getConnectionSet()) { System.out.printf("%03d %-32s %-22s %-8s %s\n", // i++, // conn.getClientId(), // conn.getClientAddr(), // conn.getLanguage(), // MQVersion.getVersionDesc(conn.getVersion())// ); } // 打印订阅关系 System.out.println("\nBelow is subscription:"); Iterator<Entry<String, SubscriptionData>> it = cc.getSubscriptionTable().entrySet().iterator(); i = 1; while (it.hasNext()) { Entry<String, SubscriptionData> entry = it.next(); SubscriptionData sd = entry.getValue(); System.out.printf("%03d Topic: %-40s SubExpression: %s\n", // i++, // sd.getTopic(), // sd.getSubString()// ); } // 打印其他订阅参数 System.out.println(""); System.out.printf("ConsumeType: %s\n", cc.getConsumeType()); System.out.printf("MessageModel: %s\n", cc.getMessageModel()); System.out.printf("ConsumeFromWhere: %s\n", cc.getConsumeFromWhere()); } catch (Exception e) { e.printStackTrace(); } finally { defaultMQAdminExt.shutdown(); } }