Java Code Examples for org.apache.rocketmq.common.protocol.body.ClusterInfo#encode()
The following examples show how to use
org.apache.rocketmq.common.protocol.body.ClusterInfo#encode() .
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: ClusterInfoTest.java From rocketmq with Apache License 2.0 | 6 votes |
@Test public void testFormJson() throws Exception { ClusterInfo clusterInfo = buildClusterInfo(); byte[] data = clusterInfo.encode(); ClusterInfo json = RemotingSerializable.decode(data, ClusterInfo.class); assertNotNull(json); assertNotNull(json.getClusterAddrTable()); assertTrue(json.getClusterAddrTable().containsKey("DEFAULT_CLUSTER")); assertTrue(json.getClusterAddrTable().get("DEFAULT_CLUSTER").contains("master")); assertNotNull(json.getBrokerAddrTable()); assertTrue(json.getBrokerAddrTable().containsKey("master")); assertEquals(json.getBrokerAddrTable().get("master").getBrokerName(), "master"); assertEquals(json.getBrokerAddrTable().get("master").getCluster(), "DEFAULT_CLUSTER"); assertEquals(json.getBrokerAddrTable().get("master").getBrokerAddrs().get(MixAll.MASTER_ID), MixAll.getLocalhostByNetworkInterface()); }
Example 2
Source File: RouteInfoManager.java From rocketmq-4.3.0 with Apache License 2.0 | 5 votes |
public byte[] getAllClusterInfo() { ClusterInfo clusterInfoSerializeWrapper = new ClusterInfo(); // broker数据 clusterInfoSerializeWrapper.setBrokerAddrTable(this.brokerAddrTable); // broker集群 clusterInfoSerializeWrapper.setClusterAddrTable(this.clusterAddrTable); return clusterInfoSerializeWrapper.encode(); }
Example 3
Source File: RouteInfoManager.java From rocketmq-read with Apache License 2.0 | 5 votes |
/** * 获取全部的集群信息 * @return return 封装的集群的信息 */ public byte[] getAllClusterInfo() { ClusterInfo clusterInfoSerializeWrapper = new ClusterInfo(); clusterInfoSerializeWrapper.setBrokerAddrTable(this.brokerAddrTable); clusterInfoSerializeWrapper.setClusterAddrTable(this.clusterAddrTable); return clusterInfoSerializeWrapper.encode(); }
Example 4
Source File: ClusterInfoTest.java From rocketmq with Apache License 2.0 | 5 votes |
@Test public void testRetrieveAllClusterNames() throws Exception { ClusterInfo clusterInfo = buildClusterInfo(); byte[] data = clusterInfo.encode(); ClusterInfo json = RemotingSerializable.decode(data, ClusterInfo.class); assertArrayEquals(new String[]{"DEFAULT_CLUSTER"}, json.retrieveAllClusterNames()); }
Example 5
Source File: ClusterInfoTest.java From rocketmq with Apache License 2.0 | 5 votes |
@Test public void testRetrieveAllAddrByCluster() throws Exception { ClusterInfo clusterInfo = buildClusterInfo(); byte[] data = clusterInfo.encode(); ClusterInfo json = RemotingSerializable.decode(data, ClusterInfo.class); assertArrayEquals(new String[]{MixAll.getLocalhostByNetworkInterface()}, json.retrieveAllAddrByCluster("DEFAULT_CLUSTER")); }
Example 6
Source File: RouteInfoManager.java From DDMQ with Apache License 2.0 | 4 votes |
public byte[] getAllClusterInfo() { ClusterInfo clusterInfoSerializeWrapper = new ClusterInfo(); clusterInfoSerializeWrapper.setBrokerAddrTable(this.brokerAddrTable); clusterInfoSerializeWrapper.setClusterAddrTable(this.clusterAddrTable); return clusterInfoSerializeWrapper.encode(); }
Example 7
Source File: RouteInfoManager.java From rocketmq with Apache License 2.0 | 4 votes |
public byte[] getAllClusterInfo() { ClusterInfo clusterInfoSerializeWrapper = new ClusterInfo(); clusterInfoSerializeWrapper.setBrokerAddrTable(this.brokerAddrTable); clusterInfoSerializeWrapper.setClusterAddrTable(this.clusterAddrTable); return clusterInfoSerializeWrapper.encode(); }
Example 8
Source File: RouteInfoManager.java From DDMQ with Apache License 2.0 | 4 votes |
public byte[] getAllClusterInfo() { ClusterInfo clusterInfoSerializeWrapper = new ClusterInfo(); clusterInfoSerializeWrapper.setBrokerAddrTable(this.brokerAddrTable); clusterInfoSerializeWrapper.setClusterAddrTable(this.clusterAddrTable); return clusterInfoSerializeWrapper.encode(); }
Example 9
Source File: RouteInfoManager.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 4 votes |
public byte[] getAllClusterInfo() { ClusterInfo clusterInfoSerializeWrapper = new ClusterInfo(); clusterInfoSerializeWrapper.setBrokerAddrTable(this.brokerAddrTable); clusterInfoSerializeWrapper.setClusterAddrTable(this.clusterAddrTable); return clusterInfoSerializeWrapper.encode(); }
Example 10
Source File: RouteInfoManager.java From rocketmq_trans_message with Apache License 2.0 | 4 votes |
public byte[] getAllClusterInfo() { ClusterInfo clusterInfoSerializeWrapper = new ClusterInfo(); clusterInfoSerializeWrapper.setBrokerAddrTable(this.brokerAddrTable); clusterInfoSerializeWrapper.setClusterAddrTable(this.clusterAddrTable); return clusterInfoSerializeWrapper.encode(); }
Example 11
Source File: RouteInfoManager.java From rocketmq with Apache License 2.0 | 4 votes |
public byte[] getAllClusterInfo() { ClusterInfo clusterInfoSerializeWrapper = new ClusterInfo(); clusterInfoSerializeWrapper.setBrokerAddrTable(this.brokerAddrTable); clusterInfoSerializeWrapper.setClusterAddrTable(this.clusterAddrTable); return clusterInfoSerializeWrapper.encode(); }